I feel like such a pain now, but let me try to explain this a little better.
In order to create the pips on the desktop I am using the buttongroup_counter template and lua file from CoreRPG. The only difference is I stripped out all reference to the database. Once I did that, I was able to get the buttons to click on and off as expected. When I add debug commands into the lua file I can generate the correct value. The thing I'm struggling with is now how to I pull that info from the file? I tried registering controls. I tried the getmodifierkey like in 5e. Nothing I have tried will pull a value of 1 to 5 as I would like.
As of right now, the only change I have made that makes things work is stripping out the database stuff so the buttons will react. At this point I don't know what else to do to get the info out.
I am attaching the lua file here for reference. As I said, all I did was strip the db info. Any insight on how to now pull the value out of this file and store it in a variable in another lua file? I looked at the 5E code, and from what I can see, it's just looking for a single button to be on or off I tried to manipulate it to work for a variable button, but I couldn't figure it out.
for reference, here is the template:
and here is the windowclass I am using it in:Code:<template name="dice_counter">
<genericcontrol>
<stateicons>
<on>button_checkon</on>
<off>button_checkoff</off>
</stateicons>
<script file="desktop/scripts/dice_counter.lua" />
</genericcontrol>
</template>
I have also added the file to base.xml.Code:<windowclass name="rollpanel">
<sizelimits>
<minimum width="64" height="52" />
</sizelimits>
<noclose />
<sheetdata>
<dice_counter name="diegroup">
<anchored position="insidetopleft" offset="4,50" width="60"/>
<allowsinglespacing />
<stateicons>
<on>button_checkon2</on>
<off>button_checkoff2</off>
</stateicons>
<values>
<maximum>5</maximum>
<current>2</current>
</values>
<sourcefields>
<current>curr</current>
</sourcefields>
<maxslotperrow>5</maxslotperrow>
</dice_counter>
</sheetdata>
</windowclass>
right now, that's everything I have and did. I don't know what to do next so when I run this function in a different file:
how do I get rolling20 to be the value 1 to 5, depending on how many pips are turned on?Code:function taskcheck(draginfo, winFrame, foc, tar)
local nodeWin = winFrame.getDatabaseNode();
local node = DB.findNode(".");
local rActor = ActorManager.getActor("pc", nodeWin);
local rolling20 = 0;
rolling20 =????????;
local sides = 20;
local TN = DB.getValue(nodeWin, tar);
local FC = DB.getValue(nodeWin, foc);
local nDiff = ActionsManager2.encodeDesktopDiff(nDiff);
local nComp = 1 -- nodeWin.getChild("rollable.comprange").getValue();
local comp = 21 - nComp
local sParams = rolling20.."d"..sides.."t"..TN.."f"..FC.."c"..comp.."d"..nDiff;
local msg = {font = "sheetlabel"};
msg.text = rActor.sName .. " rolls a task"
Comm.deliverChatMessage(msg);
local msg = {font = "sheetlabel"};
msg.text= "Target Number.." .. TN.."\nFocus Range.."..FC.."\nComplication Range.."..nComp.."\nDifficulty.."..nDiff.."\nRolling "..rolling20.. "d20\n";
Comm.deliverChatMessage(msg);
resetdice(winFrame);
DiceRoller.performAction(draginfo, rActor, sParams)
return true;
end
I hope that all makes sense. I have been staring at this code for 2 weeks now, and I have to somehow get it to work.