PDA

View Full Version : CoreRPG and the changes in dice rolling



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.

damned
January 14th, 2016, 09:03
You probably want to use a tool to compare an unpacked CoreRPG3.1.5 with CoreRPG3.1.1 or CoreRPG3.0.13 whatever was last that you had tested it against...

Ardem
January 14th, 2016, 09:50
Yeah I am comparing using Notepad++ but so many changes. Looks like I have my work cut out for me. <smile>

Also the first bit of code is not calling anything from Core, and should work regardless of core changes however, if I put the old Core in the one I have is 3.0.9 (only by chance a copy of FG on another Disk) so its quiet old not not have anything newer. Never thought to backup CoreRPG paks.

-- Comm.throwDice("initiative", {"d10"}, window.initiative.getValue(), "Initative:", customdata); This part I know hits the chat window so I know its after this point I lose it and does not return a value.

damned
January 14th, 2016, 10:06
I have some other versions I can send you -
3.0.9
3.0.10
3.0.10
3.0.12
3.0.13
3.1.1
3.1.2
3.1.4
3.1.5
3.1.6

It looks like Im missing a couple.

Trenloe mentioned a tool he uses to compare files but I cannot find the post... he is in almost every thread :)

Ardem
January 14th, 2016, 11:19
Notepad++ with compare plug in is really good, if you can send me 3.0.13, 3.1.1 to 3.1.2 and 3.1.4. My guess is the would probably the major version change.

You can add me on Steam under the name ViViD at the moment with a bottle of glenfiddich as the image.

damned
January 14th, 2016, 11:39
I just sent you 4 large emails...

Ardem
January 15th, 2016, 01:06
Thanks Damn, your files helped me enormously. Between 3.1.2 and 3.1.4 the Call for chat_window.lua was changed from desktop_classes to template desktop.xml. I have now been able to fix the dice rolling bugs and can now put up a new version of EE that will work.