PDA

View Full Version : Labyrinth Lord - Totals for die rolls



NineShadowEyes
September 17th, 2013, 18:42
Hi,

There used to be a way to change a previous ruleset so that die rolls were added up and totaled, but it seems to be different with the Labyrinth Lord ruleset. I don't know where to start.

Anyone know how to make the LL ruleset add up and total die rolls?

It'd much appreciated.

Thanks.

Moon Wizard
September 17th, 2013, 18:50
There's a "dicedisplay" parameter that can be passed as a part of the message structure to addChatMessage and deliverChatMessage API calls. If this parameter is set to 1, then the dice total will be shown when the chat entry is displayed, just as if someone had selected the radial menu option to sum the dice.

In order to use this parameter, the ruleset needs to capture the onDiceLanded event in the chatwindow, and generate the corresponding chat message. This is how the 3.5E/4E rulesets are currenlty built, and how the CoreRPG base ruleset layer in v3.0 will be built.

Regards,
JPG

NineShadowEyes
September 17th, 2013, 19:05
Um.... thanks... I think.

I grepped 'dicedisplay', 'addChatMessage' and 'deliverChatMessage' in all the LL ruleset files and came up with nothing.

What file(s) am I supposed to be looking in? Line number?

Thanks.

Moon Wizard
September 17th, 2013, 19:26
LabyrinthLord is a community ruleset, so I'm not familiar with it's code.

However, I was able to find the onDiceLanded event call in the scripts\chat_chat.lua file on line 42. There is an example of the message structure here in the "fullattack" handling section. You would need to extend this to the "dice" drag type as well.

Regards,
JPG

NineShadowEyes
September 17th, 2013, 19:31
Thanks. I'll see if I can figure it out.

NineShadowEyes
September 17th, 2013, 22:03
Nope, sorry. I can't make any sense of that at all. Alas...

Trenloe
September 17th, 2013, 22:52
Try this, the code in red is the code added to display the dice total - actually displaying the roll result earlier than before. The return true at the end stops the normal display of the roll (without the total):


function onDiceLanded(draginfo)
if ChatManager.getDieRevealFlag() then
draginfo.revealDice(true);
end

if draginfo.isType("fullattack") then
for i = 1, draginfo.getSlotCount() do
draginfo.setSlot(i);

if not ModifierStack.isEmpty() then
local originalnumber = draginfo.getNumberData();
local numstr = originalnumber;
if originalnumber > 0 then
numstr = "+" .. originalnumber;
end

draginfo.setStringData(draginfo.getStringData() .. " " .. numstr .. " (" .. ModifierStack.getDescription(true) .. ")");
draginfo.setNumberData(draginfo.getNumberData() + ModifierStack.getSum());
end

local entry = {};
entry.text = draginfo.getStringData();
entry.font = "systemfont";
entry.dice = draginfo.getDieList();
entry.diemodifier = draginfo.getNumberData();

-- optional portait
if ChatManager then
entry = ChatManager.checkPortrait(entry,"");
end

if User.isHost() then
if ChatManager.getDieRevealFlag() then
entry.dicesecret = false;
end
entry.sender = GmIdentityManager.getCurrent();
else
entry.sender = User.getIdentityLabel();
end

deliverMessage(entry);
end

ModifierStack.reset();
return true;
elseif draginfo.isType("dice") then
applyModifierStackToRoll(draginfo);
local entry = {};
entry.text = draginfo.getDescription();
entry.font = "systemfont";
entry.dice = draginfo.getDieList();
entry.diemodifier = draginfo.getNumberData();
entry.dicedisplay = 1;
-- optional portait
if ChatManager then
entry = ChatManager.checkPortrait(entry,"");
end

if User.isHost() then
if ChatManager.getDieRevealFlag() then
entry.dicesecret = false;
end
entry.sender = GmIdentityManager.getCurrent();
else
entry.sender = User.getIdentityLabel();
end

deliverMessage(entry);

return true

end
end

NineShadowEyes
September 18th, 2013, 00:25
Wow, cool. That worked. Thanks!