Move an object and events?
by Danny Csaky · in Torque Game Engine · 11/18/2005 (5:09 am) · 7 replies
Hi,
I'm used to using Flash actionscript, so this stuff is new to me.
how do create an event that works when you push a key?
is it something like?
controls.keyUP(){
$movementX++;
objectME.position($movementX)
}
I'm used to using Flash actionscript, so this stuff is new to me.
how do create an event that works when you push a key?
is it something like?
controls.keyUP(){
$movementX++;
objectME.position($movementX)
}
About the author
#2
11/18/2005 (7:17 am)
Anytime you change the contorl scheme around make sure you clear out your DSO files.
#3
is that for every DSO file or just the default.bind.DSO files?
What does the DSO files do? I noticed for every script file it creates one, is it like a backup version of the script files?
11/18/2005 (8:23 pm)
"Anytime you change the contorl scheme around make sure you clear out your DSO files."is that for every DSO file or just the default.bind.DSO files?
What does the DSO files do? I noticed for every script file it creates one, is it like a backup version of the script files?
#4
config.cs
config.cs.dso
The reason is that the order for loading in key binds is the following:
Load in the defaults (default.bind.dso if it exists, or default.bind.cs if not)
Load in the user-modified keybinds (config.cs.dso if it exists, or config.cs) which override the defaults just loaded.
This is to allow the developer to provide default keybinds if no user set config.cs (which is generated during runtime by the executable) exists, otherwise use what the player has set. It can be a bit of a hassle for developers, but once your keybinds are set, it works well.
11/19/2005 (2:50 pm)
Actually, what you need to do is to delete the following:config.cs
config.cs.dso
The reason is that the order for loading in key binds is the following:
Load in the defaults (default.bind.dso if it exists, or default.bind.cs if not)
Load in the user-modified keybinds (config.cs.dso if it exists, or config.cs) which override the defaults just loaded.
This is to allow the developer to provide default keybinds if no user set config.cs (which is generated during runtime by the executable) exists, otherwise use what the player has set. It can be a bit of a hassle for developers, but once your keybinds are set, it works well.
#5
11/19/2005 (4:49 pm)
The engine automatically detects changes to your CS files and recompiles a new DSO for it. But sometimes it doesn't do so. Most of us make a batch file to delete all our DSO files after saving a new CS to "make sure" it recompiles.
#6
11/19/2005 (10:59 pm)
Batch file is a good idea. :) 1.4 is a little better but still seems to miss things from time to time.
#7
11/20/2005 (7:54 am)
@Ramen: you are correct, but it is not enough to simply clear out all .dso files in this specific scenario (changing a default keybind). The config.cs/dso files are the root issue here, as I mention above. Even if you do delete all the .dso files, you would still have the config.cs file, which would then be compiled, and then read in on top of your default keybinds, getting rid of them.
Torque Owner Dreamer
Default Studio Name
But basically you bind a key to a command
That command is passed a value true or false.
true means the button is down, false means it's up.
You code around whatever key state it is you are looking for.
for instance.
moveMap.bind(m,"toggleMap"); function toggleMap(%val){ if(%val){ //key is down guihudmap.setVisible(1); }else{ //key is up guihudmap.setVisible(0); } }Hope that helps.