-
January 3rd, 2019, 22:18 #1
Grouping and then referencing controls in the group
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.
Code:<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>
MBMRuleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 3rd, 2019, 23:09 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,557
There is no concept of "grouping" controls. You can use subwindows and windowlists to create something similar, but you should only use when appropriate to the data you're trying to display.
I wouldn't group the frame anyway, since you may not always want the frame.
A couple ways I would look at:
1. Create a single template that uses text and bitmap widgets to lay out the label and dots as needed to match the value of the control template. This would require lots of fiddling as you would need to define exact widget placement based on existing control size. Also, you need the template to track both the current and maximum values for the dots.
2. Create templates for each component that use relative layout to a single "parent" control object. Then, just add the templates as a group with the right relative layout names.
Also, you should look at using the existing "buttongroup_counter" template in the CoreRPG ruleset to implement the dots instead of implementing your own.
Regards,
JPG
-
January 3rd, 2019, 23:14 #3Ruleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 3rd, 2019, 23:20 #4
Have a look at the Trackers in MoreCore.
Im not rolling dice but I do reference the number of dots and the name of the tracker.
-
January 3rd, 2019, 23:28 #5Ruleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 3rd, 2019, 23:47 #6
Have a look at the Trackers in MoreCore.
-
January 3rd, 2019, 23:49 #7Ruleset and much more content built for FGU.
Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!
-
January 4th, 2019, 00:09 #8
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,557
The common button counter templates weren't around for the VtM ruleset originally (along with a lot of other pieces). It might be worth reviewing the CoreRPG common templates to see what is available.
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks