PDA

View Full Version : Need CustomData in 3.5E Ruleset



Grimmbart
April 9th, 2019, 16:22
Hi everybody

I'm using the 3.5E (latest version) rule set for a custom ruleset and I need to send custom data when the player rolls a die.
In the "buildThrow (...)" function, I think it's a good place to insert custom data. But after, in the function "onDiceLanded (draginfo)", no way to find them!


In the function "buildThrow (...)", I add my data in the following way (in 2 different places!?):


local rThrow = {};
rThrow.type = rRoll.sType;
rThrow.description = rRoll.sDesc;
rThrow.secret = rRoll.bSecret;
rThrow.customData = rRoll.aCustomData;

...

local rSlot = {};
rSlot.number = rRoll.nMod;
rSlot.dice = rRoll.aDice;
rSlot.metadata = rRoll;
rSlot.customData = rRoll.aCustomData;
rThrow.slots = { rSlot };

return rThrow;

After that, in the "onDiceLanded (draginfo)" function, I can not find my information :

function onDiceLanded(draginfo)

local sDragType = draginfo.getType();
draginfo.setSlot(1);
local vRoll = draginfo.getMetaDataList();
vRoll.sDesc = draginfo.getStringData();
vRoll.aCustomData = draginfo.getCustomData();
Debug.console ("onDiceLanded-decodeActionFromDrag vRoll.sDesc: " .. vRoll.sDesc); OK
Debug.console ("onDiceLanded-decodeActionFromDrag vRoll.aCustomData: " .. vRoll.aCustomData); NIL Value !!
...

Any idea ?

damned
April 9th, 2019, 22:43
I think you will want to append the customdata to the description and then split it back out in onDiceLanded.

Bidmaron
April 9th, 2019, 22:48
Yep. That is the only way I have found to do it. Maybe we can sweet talk MW into preserving custom data across a roll in FGU

Grimmbart
April 10th, 2019, 09:05
I think you will want to append the customdata to the description and then split it back out in onDiceLanded.

Yes, that's exactly what I would like to do !

But of course, I can concatenate my info to the description and split the string after. Why not !

damned
April 10th, 2019, 09:55
Yes, that's exactly what I would like to do !

But of course, I can concatenate my info to the description and split the string after. Why not !

You are on the right track!