Author Topic: Button commands  (Read 843 times)

I am wondering how you could press a button for example Z,
in a gui and it will do the function a apply to it.
I have been looking, and I cant find out how.

So you are telling me you couldent find THIS: http://forum.blockland.us/index.php?topic=67198.msg1122571#msg1122571 In the first topic of General Modification Help. I doubt you looked XD

So you are telling me you couldent find THIS: http://forum.blockland.us/index.php?topic=67198.msg1122571#msg1122571 In the first topic of General Modification Help. I doubt you looked XD
No, not that, I believe its something do with actionmap, the Editor script has what I need, once I get to my computer I will see.

Sorry for double posting but I found out that it uses an action map.
But now I need the variables and there two different commands.

Actionmap.bind()
and actionmap.bindcmd().

Wich do I use?

sorry for bump, hope this helps though
Quote from: The Torque Appendix Section A.2.1 Action Map
bind( device , action , [ modifier , mod... ] , command )
Purpose
Use the bind method to associate a function to a keystroke or other device input.
Syntax
device - Name of the device to bind the command to (see 'Device Table' below).
action - Name of the action to watch for(see 'Action Table' below).
modifier – Special modifiers (mouse only), such as dead spot, etc.
command - The function to be called on make and break.
Returns
No return value.
Notes
The command bound via the bind function must be specified as a flat name with no elipses
or semi-colon termination and will be called on make and break events (i.e. key press and
release for a mapped key).
Args:
Warning: When a function is bound to a keystroke or other device input, and no other
versions of the binding are provided, the function will be called even if a modifier key
like CTRL, ALT, or SHIFT is also pressed. For clarification, see 'Bind Sample' example
below.

In your case:
actionmap.bind(keyboard0, Z, , , function(););
however... I don't think it is possible to make it so that this ONLY works while a specific GUI is open....
« Last Edit: September 11, 2011, 07:23:29 PM by wizzlemanizzle »

Sorry for double posting but I found out that it uses an action map.
But now I need the variables and there two different commands.

Actionmap.bind()
and actionmap.bindcmd().

Wich do I use?
Wait, you said in the OP that you want to press a button on a GUI and have that do a command, now you're saying you want a keybind?
These are two completely different things, which do you want?

Wait, you said in the OP that you want to press a button on a GUI and have that do a command, now you're saying you want a keybind?
These are two completely different things, which do you want?
Sorry if I didnt make complete sense, I meant for you can only press it if the gui is open, if its not, the keyboard button will do nothing.

sorry for bump, hope this helps though
In your case:
actionmap.bind(keyboard0, Z, , , function(););
however... I don't think it is possible to make it so that this ONLY works while a specific GUI is open....

new GuiBitmapCtrl(GuiZButton)
{
   command = "blah_blah_blah();"; //this runs when you press the accelerator or click the image
   accelerator = "Z";
   //all the required variables, I don't know which ones are and which ones aren't
   //pretty sure for a bitmap you need a profile and a filepath
};
« Last Edit: September 12, 2011, 07:24:06 PM by Xalos »