Dynamic buttons
by Santosh Pillai · in Technical Issues · 05/07/2008 (9:49 pm) · 1 replies
Hi,
i want to know whether the number of buttons can change at run time.Like what i am trying is if in a multiplayer game one option is there if a user clicks on current number of players it displays the number of players.Against each player a button is there if its clicked displays the player profile....for this the buttons should be dynamic in number...depending on the number of players....
if it can be done some coding is needed.......
i want to know whether the number of buttons can change at run time.Like what i am trying is if in a multiplayer game one option is there if a user clicks on current number of players it displays the number of players.Against each player a button is there if its clicked displays the player profile....for this the buttons should be dynamic in number...depending on the number of players....
if it can be done some coding is needed.......
Torque Owner Andy Rollins
ZDay Game
function addButton() { %obj = new GuiButtonCtrl() { canSaveDynamicFields = "0"; Profile = "GuiButtonProfile"; HorizSizing = "right"; VertSizing = "bottom"; Position = "10 180"; Extent = "155 30"; MinExtent = "8 2"; canSave = "1"; Visible = "1"; hovertime = "1000"; text = "test"; Command = ""; groupNum = -1; buttonType = "PushButton"; }; parent_obj.add(%obj); }Hopefully its self explanitory apart from the last line, parent_obj would be whatever container you are using to put this button in, which could be the main GuiControl for the GUI, a scrolling list, etc... if you need more information look at your .gui files that come with TGE and you'll see how gui objects are placed within containers/parent objects.