Ardem
January 14th, 2016, 08:57
I thought to myself, I better check Extinction Event Rule and update it, since I have a little time. But what I thought would be a quick fix turns into OH MY GOODNESS! What the hell. And since I have not been coding now for almost 12 months everything I did understand even CORE basic functions has gone right out the window. So I need a little help before I kick the hell out of something.
I understand for progression code things needs to change, but the dice code changing so much since I last looked at it. <sigh>
If we can aim a couple of simple dice rolling and where I need to look what is going wrong a pointer would be nice.
In the past probably about 7 months ago this function worked, it grabbed and returned a dice roll to a field. Now it doesn't return.
function action(draginfo)
local customdata={};
customdata = getDatabaseNode().getNodeName();
Comm.throwDice("initiative", {"d10"}, window.initiative.getValue(), "Initative:", customdata);
end
The next one worked as well. It rolled two dice and returned one in a blue colour and the other in a red colour in the chat window. Note sType looked like this in the gamesystem.lua ( ["wndcheck"] = { },) which went to the last code.
function action(draginfo)
local aDice = {};
local modifier = ModifierStack.getSum();
table.insert(aDice,"d10");
table.insert(aDice,"d10");
local rActor = ActorManager.getActor("pc", nodeChar);
local rRoll = { sType = "wndcheck", sDesc = ("Wound Location Roll: Location, Wound"), aDice = aDice, nMod = modifier };
ActionsManager.performAction(draginfo, rActor, rRoll);
return true;
end
function wndcheck(draginfo)
local entry = {}; -- Create Message Array
local nResult = 0; -- Die Result Transfer
nMod=draginfo.getNumberData(); -- Get Target Number and modifier
entry.dice = {};
entry.text = draginfo.getDescription() .. " Modifier: " .. nMod;
for i,v in ipairs(draginfo.getDieList()) do
nResult = v.result;
if i==1 then
table.insert(entry.dice,{type="b10",result=nResult});
elseif i==2 then
nResult=nResult+nMod;
if nResult > 10 then
nResult = 10;
elseif nResult < 1 then
nResult = 1;
end
table.insert(entry.dice,{type="r10",result=nResult});
else
table.insert(entry.dice,{type="d10",result=nResult});
end
end
if User.isHost() then -- Adds whos is sending the Message, GM or Player
entry.sender = GmIdentityManager.getCurrent();
Comm.deliverChatMessage(entry);
else
entry.sender = User.getIdentityLabel();
Comm.deliverChatMessage(entry);
end
Just some pointers would help because its been so long it going to take me ages to figure this out again. Thanks for any assistance.
I understand for progression code things needs to change, but the dice code changing so much since I last looked at it. <sigh>
If we can aim a couple of simple dice rolling and where I need to look what is going wrong a pointer would be nice.
In the past probably about 7 months ago this function worked, it grabbed and returned a dice roll to a field. Now it doesn't return.
function action(draginfo)
local customdata={};
customdata = getDatabaseNode().getNodeName();
Comm.throwDice("initiative", {"d10"}, window.initiative.getValue(), "Initative:", customdata);
end
The next one worked as well. It rolled two dice and returned one in a blue colour and the other in a red colour in the chat window. Note sType looked like this in the gamesystem.lua ( ["wndcheck"] = { },) which went to the last code.
function action(draginfo)
local aDice = {};
local modifier = ModifierStack.getSum();
table.insert(aDice,"d10");
table.insert(aDice,"d10");
local rActor = ActorManager.getActor("pc", nodeChar);
local rRoll = { sType = "wndcheck", sDesc = ("Wound Location Roll: Location, Wound"), aDice = aDice, nMod = modifier };
ActionsManager.performAction(draginfo, rActor, rRoll);
return true;
end
function wndcheck(draginfo)
local entry = {}; -- Create Message Array
local nResult = 0; -- Die Result Transfer
nMod=draginfo.getNumberData(); -- Get Target Number and modifier
entry.dice = {};
entry.text = draginfo.getDescription() .. " Modifier: " .. nMod;
for i,v in ipairs(draginfo.getDieList()) do
nResult = v.result;
if i==1 then
table.insert(entry.dice,{type="b10",result=nResult});
elseif i==2 then
nResult=nResult+nMod;
if nResult > 10 then
nResult = 10;
elseif nResult < 1 then
nResult = 1;
end
table.insert(entry.dice,{type="r10",result=nResult});
else
table.insert(entry.dice,{type="d10",result=nResult});
end
end
if User.isHost() then -- Adds whos is sending the Message, GM or Player
entry.sender = GmIdentityManager.getCurrent();
Comm.deliverChatMessage(entry);
else
entry.sender = User.getIdentityLabel();
Comm.deliverChatMessage(entry);
end
Just some pointers would help because its been so long it going to take me ages to figure this out again. Thanks for any assistance.