MadBeardMan
January 3rd, 2019, 22:18
Greetings All,
Thanks for the help so far on the random questions I've posted here.
Here's another that I'd like help with.
This code is to roll a number of dice to check for successes, it works getting the dice to roll (dot control) and I get the correct dice, but I don't know what dice roll this is.
Within the code there's a frame and then there's a label and then a dot control (1 dot per dice to roll) and then the 'roll the dice button'.
What I'd like to do is to group these inside a control, so that I can reference the label (to get what roll is about to be made) and get the number of dots without direct reference.
Ideally I'd like to place this into the button_roll class, but not sure then how to reference things.
If anyone could help that would be ace.
<frame_char name="init_frame">
<bounds>25,75,155,50</bounds>
</frame_char>
<label_frametop>
<anchored to="init_frame" />
<static textres="dicepool_label_initiative" />
<font>reference-headermini</font>
</label_frametop>
<dotcontrol name="initiativemod" >
<anchored to="init_frame" position="insidetopleft" offset="27,30" width="100" height="10" />
<center />
<readonly />
<dots>10</dots>
</dotcontrol>
<button_roll name="initiative_roll">
<anchored to="init_frame" position="insidetopleft" offset="0,0" width="18" height="18" />
<script>
function action(draginfo)
local nodeWin = window.getDatabaseNode();
if nodeWin then
local nTotal = window.initiativemod.getValue();
local nodeChar = nodeWin.getChild("...");
local rActor = ActorManager.getActor("pc", nodeChar);
print ('Dice to roll: ' .. nTotal)
end
return true;
end
function onDragStart(button, x, y, draginfo)
return action(draginfo);
end
function onDoubleClick(x,y)
return action();
end
</script>
</button_roll>
Cheers,
MBM
Thanks for the help so far on the random questions I've posted here.
Here's another that I'd like help with.
This code is to roll a number of dice to check for successes, it works getting the dice to roll (dot control) and I get the correct dice, but I don't know what dice roll this is.
Within the code there's a frame and then there's a label and then a dot control (1 dot per dice to roll) and then the 'roll the dice button'.
What I'd like to do is to group these inside a control, so that I can reference the label (to get what roll is about to be made) and get the number of dots without direct reference.
Ideally I'd like to place this into the button_roll class, but not sure then how to reference things.
If anyone could help that would be ace.
<frame_char name="init_frame">
<bounds>25,75,155,50</bounds>
</frame_char>
<label_frametop>
<anchored to="init_frame" />
<static textres="dicepool_label_initiative" />
<font>reference-headermini</font>
</label_frametop>
<dotcontrol name="initiativemod" >
<anchored to="init_frame" position="insidetopleft" offset="27,30" width="100" height="10" />
<center />
<readonly />
<dots>10</dots>
</dotcontrol>
<button_roll name="initiative_roll">
<anchored to="init_frame" position="insidetopleft" offset="0,0" width="18" height="18" />
<script>
function action(draginfo)
local nodeWin = window.getDatabaseNode();
if nodeWin then
local nTotal = window.initiativemod.getValue();
local nodeChar = nodeWin.getChild("...");
local rActor = ActorManager.getActor("pc", nodeChar);
print ('Dice to roll: ' .. nTotal)
end
return true;
end
function onDragStart(button, x, y, draginfo)
return action(draginfo);
end
function onDoubleClick(x,y)
return action();
end
</script>
</button_roll>
Cheers,
MBM