FG Spreadshirt Swag
  1. #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>
    Cheers,
    MBM
    Ruleset and much more content built for FGU.
    Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!

  2. #2
    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

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    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
    Hi Chap,

    Thanks for the detailed response.

    I'll go back to Dan on this (it's for the Vampire ruleset) as he added all the windows with all the controls and dots and things.

    Cheers
    MBM
    Ruleset and much more content built for FGU.
    Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!

  4. #4
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    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.

  5. #5
    Quote Originally Posted by damned View Post
    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.
    Morning Chap,

    Ok thanks, I have dice rolling, just trying to find a better way to code it, rather than a lot of copied code across a lot of skills/disciplines/attributes etc.

    Cheers,
    MBM
    Ruleset and much more content built for FGU.
    Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!

  6. #6

  7. #7
    Quote Originally Posted by damned View Post
    Have a look at the Trackers in MoreCore.
    Great, I've made Dan aware of this thread, he's going to look at the Dots tomorrow.
    Ruleset and much more content built for FGU.
    Come join me on Twitter at: https://twitter.com/MadBeardMan to see what I'm up to!

  8. #8
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in