Some Scripting Questions...
by Donny Wilbanks · in Torque Game Engine · 03/18/2004 (3:29 pm) · 29 replies
Alright here are some questions that I am asking being a bit new to Torque Scripting
How to set up a loop?
classic C
String Converstions?
Conversting Numbers into Strings and Back - looks like allot of the scripting numbres are in the Text brakets. such as:
position = "4 19";
int x = 4;
int y = 19;
string sX = StringConvert(x);
string sY = StringConvert(y);
string sCombinde = sX+" "+sY;
with a output like:
position = sCombinde;
Varibles
Is there a way of setting up Global Varibles? Even if it is somethig that gets bound to a object...
Is there a way of setting up Local Varibles tide to a object? (such as a player or a static object) something that can be pointed at and access...
Switching?
How about classic "If" statments ?
Or even just what link can I look at...
How to set up a loop?
classic C
main ()
{
int i;
for (i=0;i<=10;i++)
{
// ** Do stuff
}
}String Converstions?
Conversting Numbers into Strings and Back - looks like allot of the scripting numbres are in the Text brakets. such as:
position = "4 19";
int x = 4;
int y = 19;
string sX = StringConvert(x);
string sY = StringConvert(y);
string sCombinde = sX+" "+sY;
with a output like:
position = sCombinde;
Varibles
Is there a way of setting up Global Varibles? Even if it is somethig that gets bound to a object...
Is there a way of setting up Local Varibles tide to a object? (such as a player or a static object) something that can be pointed at and access...
Switching?
How about classic "If" statments ?
Or even just what link can I look at...
#2
have more questions later..
03/18/2004 (3:53 pm)
Cool! This is bits and parts I am looking for. Now for some more expermintation. I d/l a basic base design am using it as a building block for experimentation.... No to see if I can get the loop working.have more questions later..
#3
in regular c/c++ it's
int iK = 0;
do i set it up like
int %iK = 0;
?
also can I get a example of string OR is it basicly just one big varible now?...
03/18/2004 (3:59 pm)
Setting up a string, how do I initialise or a Int for that matter, it in Torque Script?in regular c/c++ it's
int iK = 0;
do i set it up like
int %iK = 0;
?
also can I get a example of string OR is it basicly just one big varible now?...
#4
%sK = "String";
Or for that matter..
%iK = 0; // I'm an int
%iK = 0.5; // Now I'm a float
%iK = "foo"; // Now I'm a string
03/18/2004 (4:06 pm)
%iK = 0;%sK = "String";
Or for that matter..
%iK = 0; // I'm an int
%iK = 0.5; // Now I'm a float
%iK = "foo"; // Now I'm a string
#5
03/18/2004 (4:15 pm)
TorqueScript is a typeless language, and you do not declare variables. Just use them.
#6
This may work ...
Well I seam to get a Error
How to interpit?
03/18/2004 (4:35 pm)
Alright So putting togther the above. This is basicly pulled out the Demo Engine... This is putting the tower on the screen. Objective is to make the Object stamp at a non fixed location (adjustable via the varibles), this is mostly just a exersize...//--- OBJECT WRITE BEGIN ---
new GuiControl(MainMenuDlg)
{
profile = "GuiModelessDialogProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
helpTag = "0";
title = "Torque SDK Feature Demo";
new GuiControl()
{
profile = "GuiDefaultProfile";
horizSizing = "center";
vertSizing = "center";
position = "22 51";
extent = "756 498";
minExtent = "8 2";
visible = "1";
helpTag = "0";
// *DWN: My code has been added here
%iK = 5;
%iX = %iK*30 + 29;
%Pos = "19 " + %iX;
// * End my code
new GuiBitmapCtrl()
{
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
// DWN: I prelaced the " position = "19 219";
// with the varible %Pos
position = %Pos;
// End mycode...
extent = "243 291";
minExtent = "8 2";
visible = "1";
bitmap = "./tower";
wrap = "0";
helpTag = "0";
};
};
};This may work ...
Well I seam to get a Error
Compiling demo/client/ui/MainMenuDlg.gui...
demo/client/ui/MainMenuDlg.gui Line: 32 - Syntax error.
>>> Advanced script error report. Line 63.
>>> Some error context, with ## on sides of error halt:
helpTag = "0";
// *DWN: My code has been added here
%iK ##=## 5;
%iX = %iK*30 + 129;
%Pos = "19 " + %iX;
>>> Error report complete.How to interpit?
#7
03/18/2004 (4:53 pm)
Pretty sure you can't just go adding code into the middle of a GUI definition.
#8
in the middle of a gui control is invalid.
You could define the GuiBitmapCtrl() in a function within the .gui file something like
03/18/2004 (6:42 pm)
// *DWN: My code has been added here %iK = 5; %iX = %iK*30 + 29; %Pos = "19 " + %iX; // * End my code
in the middle of a gui control is invalid.
You could define the GuiBitmapCtrl() in a function within the .gui file something like
//--> RJY
// Toke this from RW for now
$NUM_IMAGES = 10;
$imageExtent = "60 50";
for(%i=0; %i<$NUM_IMAGES; %i++)
{
%imagePos = (%i*65);
if( %i < 5 )
{
%image = new GuiBitmapCtrl("daImage" @ %i)
{
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "center";
position = %imagePos @ " 5";
extent = $imageExtent;
visible = 1;
bitmap = "game/client/ui/SomeImage";
helpTag = "0";
wrap = "0";
};
SomeControl.add(%image);
}
#9
Intelligent questions with thoughtful answers. Plus I think it could end up being a nice resource.
-Jeff Tunnell GG
03/18/2004 (9:05 pm)
This is actually a very cool thread.Intelligent questions with thoughtful answers. Plus I think it could end up being a nice resource.
-Jeff Tunnell GG
#10
Putting stuff into Action ...
After putting the above together I only get 2 errors, but I think one the other one is realated to the above problem (I have seen compilers go wiggy and generate other errors because of syntax). Since I am still learning what can cause the wiggys please bare with me.
I tried it, less errors (:) but I get a "syntax error" with this varible.
$NUM_IMAGES = 10;
What is the differance between the "%" being used as a varible vrs the "$"?
EDIT: I just looked back at a earilier message, the "$" is a global varible.
do see a array like structure forming with the following?
"%image = new GuiBitmapCtrl("daImage" @ %i)"
So also If I examined this peice correctly, you are merging the text name "daImage" by using the "@" symbol with the local varible "%i". Would using "daImage" + %i work? Or would the "+" symbol be more for math functions in the scripting?
Ohh also, I noticed you put some info into the Function GuiButmapCtrl(), I will see if I can dig up the docs a list of function, may also help :)
Back to tweaking...
The basic thing I am trying with this practice is to stamp out a images to the screen with a loop function. This is all done before a mission has been started. (the nice flashy area with the tower and the buggy pictures). I figured it would be a nice place to practice looping switching and some basic text output. It looks and input before I tackle adding objects assigning varibles to them and the such. I am also learning about what code exicution looks like from the consel log, what' looks correct and what is a error. It's good to study.
Afterthought
Maybe I should chose another script to try to place images down. I did have success when I just copied the block data (it prododuced 2 images) within the same script.
03/18/2004 (9:35 pm)
That is a a good idea - Some examples of what a "C" format vrs Torque format. They are similar, but one who is unfamilure with it could do some with some comparisons. I went through the same type of cross over when I went coding from Basic to C a few years back. But I did not have anybody really to answer question (I got you guys's brains to pick - this time). Learning that not everything had nifty XXX line number and you should try to group your code into functions... hehehe. Mostly just trying to creat a similar effect to study. I spent the last year or so playing with the NWN script engine. Alot of time was spent just learning the behavoir of the mobs and interaction with the code... But back to this topic..Putting stuff into Action ...
After putting the above together I only get 2 errors, but I think one the other one is realated to the above problem (I have seen compilers go wiggy and generate other errors because of syntax). Since I am still learning what can cause the wiggys please bare with me.
I tried it, less errors (:) but I get a "syntax error" with this varible.
$NUM_IMAGES = 10;
What is the differance between the "%" being used as a varible vrs the "$"?
EDIT: I just looked back at a earilier message, the "$" is a global varible.
do see a array like structure forming with the following?
"%image = new GuiBitmapCtrl("daImage" @ %i)"
So also If I examined this peice correctly, you are merging the text name "daImage" by using the "@" symbol with the local varible "%i". Would using "daImage" + %i work? Or would the "+" symbol be more for math functions in the scripting?
Ohh also, I noticed you put some info into the Function GuiButmapCtrl(), I will see if I can dig up the docs a list of function, may also help :)
Back to tweaking...
The basic thing I am trying with this practice is to stamp out a images to the screen with a loop function. This is all done before a mission has been started. (the nice flashy area with the tower and the buggy pictures). I figured it would be a nice place to practice looping switching and some basic text output. It looks and input before I tackle adding objects assigning varibles to them and the such. I am also learning about what code exicution looks like from the consel log, what' looks correct and what is a error. It's good to study.
Afterthought
Maybe I should chose another script to try to place images down. I did have success when I just copied the block data (it prododuced 2 images) within the same script.
#11
this code works.. No errors in the compiler recored..
as you can see I have bits and parts of the above code snipts commented out. I kept getting syntax errors.
Just as soon as I uncomment the "%i" (or any of the commented varibles) I get the syntax error. So mayby you can't do math at this point it all has to be hard scripted. So this is thinking, there may be another place to try this type of practice..
03/18/2004 (11:06 pm)
Well here's the simple 2 Tower Version, this is why I chose this location to try and make a loopthis code works.. No errors in the compiler recored..
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//--- OBJECT WRITE BEGIN ---
new GuiControl(MainMenuDlg)
{
// $NUM_IMAGES = 10;
// $imageExtent = "243 291";
// %i = 5;
// %imagePos = (%i*25);
profile = "GuiModelessDialogProfile";
horizSizing = "width";
vertSizing = "height";
position = "0 0";
extent = "800 600";
minExtent = "8 8";
visible = "1";
helpTag = "0";
title = "Torque SDK Feature Demo";
new GuiControl()
{
profile = "GuiDefaultProfile";
horizSizing = "center";
vertSizing = "center";
position = "22 51";
extent = "756 498";
minExtent = "8 2";
visible = "1";
helpTag = "0";
new GuiBitmapCtrl()
{
profile = "GuiDefaultProfile";
horizSizing = "center";
vertSizing = "center";
// position = %imagePos @ " 25";
position = "4 19";
extent = "243 291";
minExtent = "8 2";
visible = "1";
bitmap = "./tower";
helpTag = "0";
wrap = "0";
};
new GuiBitmapCtrl()
{
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "154 19";
extent = "243 291";
minExtent = "8 2";
visible = "1";
bitmap = "./tower";
wrap = "0";
helpTag = "0";
};
};
};
//--- OBJECT WRITE END ---as you can see I have bits and parts of the above code snipts commented out. I kept getting syntax errors.
Just as soon as I uncomment the "%i" (or any of the commented varibles) I get the syntax error. So mayby you can't do math at this point it all has to be hard scripted. So this is thinking, there may be another place to try this type of practice..
#12
); or echo(); functions to output data to the console which you can access by hitting ~ in-game. echo() outputs in faded grey, where error() makes something show up in bright red, so I tend to use that just so stuff is easier to find. So just write the code at the top of the main.cs file or something, and then run the .exe and look at the top of the console for your echo or error outputs. I.E.
I'm totally new to this stuff too pretty much, I just sorta looked through the .cs files for a while before I tried anything of my own.
03/18/2004 (11:20 pm)
Everything inside of a GUI control, or any object like that is supposed to be a property of that object. So no, you wouldn't want to do code there. If you want to just play around with variables and see what values you are getting, you can use the error(%i = 5;
%imagePos = (%i*25);
echo("imagePos = " @ %imagePos);The @ character basically works as a string catentator(sp?) by the way.I'm totally new to this stuff too pretty much, I just sorta looked through the .cs files for a while before I tried anything of my own.
#13
Plus not understanding *yet* the flow of the scripting engine.
So this now gives me some other questions about the GUI to think about.
I know in game(with the mission running) you can have reactive information being display on screen, health bars and the like, but I am not quite there yet. Alright thanks for the information.
I am trying to get the branching and loop function to work out.
I was hoping to be able to stamp that tower about 10 times on the screen. Not going to be probable without varibles going into the "object". or coming up with 10 scripts - each one in a slightly differant location (or one script like the one above with 8 more hard scripted pictures)..
Granted, this is not the full demo I am working with. I can't go into the mission (it's been stripped) out of the base mod I am working with. I am messing around with the intro screen so to speak.
Question then?
Well if this is being treated like a object (something solid and tangable at this point), Can a object be copied and then moved to another place after it's created?
03/18/2004 (11:36 pm)
Alright, well I have no idea (but learning), where to poke and prod. I got some results by just coping the 2 blocks and created me 2 images (once again that's why I chose that script). Plus not understanding *yet* the flow of the scripting engine.
So this now gives me some other questions about the GUI to think about.
I know in game(with the mission running) you can have reactive information being display on screen, health bars and the like, but I am not quite there yet. Alright thanks for the information.
I am trying to get the branching and loop function to work out.
I was hoping to be able to stamp that tower about 10 times on the screen. Not going to be probable without varibles going into the "object". or coming up with 10 scripts - each one in a slightly differant location (or one script like the one above with 8 more hard scripted pictures)..
Granted, this is not the full demo I am working with. I can't go into the mission (it's been stripped) out of the base mod I am working with. I am messing around with the intro screen so to speak.
Question then?
Well if this is being treated like a object (something solid and tangable at this point), Can a object be copied and then moved to another place after it's created?
#14
Let me make a suggestion, though. If you are just learning the scripting language, it's probably best to get your feet under you by reading up on some scripting basics before trying to jump right in and write or edit game code.
If you want to, check out the scripting resources linked to below. Spend a half-day or so reading these, and I think you'll be able to do the things you want to much more quickly than by jumping straight into editing existing scripts.
Beginner's scripting resources:
-Daniel Neilsen's TorqueScript Language Reference is a nice introduction to the TorqueScript language itself, for those of us who already know C/C++.
-Joel Baxter's Quick TorqueScript Language Reference also does a nice job of introducing how the language works, for those who know how to program in other languages.
After reading these two documents, you might be getting frustrated at learning how the language works, but not knowing how to manipulate objects and do cool game-ish stuff. To get good intros on doing these things, I'd recommend these resources:
-Dan Jones' Super Simple Torque Demo rocks for learning the absolute basics of setting up a GUI in Torque. Go to the page linked above and download the "supersimpletorquedemo.zip" file linked at the top of the page. Follow the instructions in the zip and you'll be on your way to doing useful things with TorqueScript. Also check out Dan's Super Simple Demo With a Console resource, also linked on the above page.
-John Vanderbeck's MinApp tutorial is awesome. It is a series of four tutorials, starting with the one linked above, which teaches you step-by-step how to manipulate the Torque Game Engine using TorqueScript. John says there are more tutorials in the series forthcoming, but with what he has up now, you will quickly master the Torque GUI and be ready to move on to actual game play.
If you want information on how to do even more stuff with the Torque engine, the Mission Editor, and TorqueScript, check out the following resources too:
-Devin Ly's Tourniquet tutorials teach you how to use the Torque Mission and GUI editors.
-The Codesampler Tutorials also go through how to get stuff rolling in Torque. Like Tourniquet, these tutorials don't focus exclusively on scripting. They also show you how to use the engine tools, if you are interested.
... continued in next post ...
03/19/2004 (1:23 am)
Great questions. Looks like you are making progress already.Let me make a suggestion, though. If you are just learning the scripting language, it's probably best to get your feet under you by reading up on some scripting basics before trying to jump right in and write or edit game code.
If you want to, check out the scripting resources linked to below. Spend a half-day or so reading these, and I think you'll be able to do the things you want to much more quickly than by jumping straight into editing existing scripts.
Beginner's scripting resources:
-Daniel Neilsen's TorqueScript Language Reference is a nice introduction to the TorqueScript language itself, for those of us who already know C/C++.
-Joel Baxter's Quick TorqueScript Language Reference also does a nice job of introducing how the language works, for those who know how to program in other languages.
After reading these two documents, you might be getting frustrated at learning how the language works, but not knowing how to manipulate objects and do cool game-ish stuff. To get good intros on doing these things, I'd recommend these resources:
-Dan Jones' Super Simple Torque Demo rocks for learning the absolute basics of setting up a GUI in Torque. Go to the page linked above and download the "supersimpletorquedemo.zip" file linked at the top of the page. Follow the instructions in the zip and you'll be on your way to doing useful things with TorqueScript. Also check out Dan's Super Simple Demo With a Console resource, also linked on the above page.
-John Vanderbeck's MinApp tutorial is awesome. It is a series of four tutorials, starting with the one linked above, which teaches you step-by-step how to manipulate the Torque Game Engine using TorqueScript. John says there are more tutorials in the series forthcoming, but with what he has up now, you will quickly master the Torque GUI and be ready to move on to actual game play.
If you want information on how to do even more stuff with the Torque engine, the Mission Editor, and TorqueScript, check out the following resources too:
-Devin Ly's Tourniquet tutorials teach you how to use the Torque Mission and GUI editors.
-The Codesampler Tutorials also go through how to get stuff rolling in Torque. Like Tourniquet, these tutorials don't focus exclusively on scripting. They also show you how to use the engine tools, if you are interested.
... continued in next post ...
#15
If you are hungry for more scripting specifics, check out the official documentation as well:
-www.garagegames.com/docs/torque.sdk/index.php#scripting and www.garagegames.com/docs/torque.sdk/index.php#tutorials
-Ron Yacketta's Console Commands reference details all the callable TorqueScript commands and objects. Useful for when you see a function in a script and want to know exactly what it does. Right now it is in .rtf format, but that will likely change some time soon.
-You can also look up old Tribes 2 scripting tutorials; an older version of Torque was used to create Tribes 2. One great example is Halide's T2 Scripting tutorial. Not all of the information in Tribes 2 scripting tutorials is up to date, but if you are hungry for tutorials, they are a decent place to look.
Ok, hope that helps! There are many good resources out there, but these are a good place to start. Still, beginning scripters aren't completely covered by the online resources.
So, it is good to have threads like this. Thanks for creating it. :)
PS: Just so you know, we have an in-depth set of official scripting tutorials forthcoming. Once these are done, new scripters will have a one-stop place to go for learning TorqueScript.
I am working on this set of tutorials, and if you don't mind, I'd like to get some feedback from you. Should you decide to read through the tutorials listed above, please email me at joshw@garagegames.com and let me know what questions you still have about TorqueScripting. It would be very helpful to me to know what areas a new scripter needs covered, even after going through the above tutorials. (Btw, the same invitation extends to anybody else who happens to read this message.)
Ok, hope I didn't melt your eyes with this monster-long set of posts. :)
03/19/2004 (1:24 am)
... continued from previous post...If you are hungry for more scripting specifics, check out the official documentation as well:
-www.garagegames.com/docs/torque.sdk/index.php#scripting and www.garagegames.com/docs/torque.sdk/index.php#tutorials
-Ron Yacketta's Console Commands reference details all the callable TorqueScript commands and objects. Useful for when you see a function in a script and want to know exactly what it does. Right now it is in .rtf format, but that will likely change some time soon.
-You can also look up old Tribes 2 scripting tutorials; an older version of Torque was used to create Tribes 2. One great example is Halide's T2 Scripting tutorial. Not all of the information in Tribes 2 scripting tutorials is up to date, but if you are hungry for tutorials, they are a decent place to look.
Ok, hope that helps! There are many good resources out there, but these are a good place to start. Still, beginning scripters aren't completely covered by the online resources.
So, it is good to have threads like this. Thanks for creating it. :)
PS: Just so you know, we have an in-depth set of official scripting tutorials forthcoming. Once these are done, new scripters will have a one-stop place to go for learning TorqueScript.
I am working on this set of tutorials, and if you don't mind, I'd like to get some feedback from you. Should you decide to read through the tutorials listed above, please email me at joshw@garagegames.com and let me know what questions you still have about TorqueScripting. It would be very helpful to me to know what areas a new scripter needs covered, even after going through the above tutorials. (Btw, the same invitation extends to anybody else who happens to read this message.)
Ok, hope I didn't melt your eyes with this monster-long set of posts. :)
#16
This is the one that I was basing my work off of in this thread, I could not find the refrence again after I started working.
I decided to see what I could find for Tuts and I have been doing the Codesamplers Tuts the last couple of hours, playing with triggers right now. Already made a tweak to, it shouts out to all players that I have entered into there area (already have insidious things that can be done to entering vic--- players) though the rest of the text does not come through...
I will have to spend time learning the engines script and studying it's behavoir. I like to poke and prod. :) see what I can come up with. But the great thing is that there are other people poking and proding to, who have been doing it for longer and thanks for this list!
For now I must go to sleep, it's 3am and I must sleep, it has been a productive night.
Thanks again for all of your help (all of the above) for providing help (and many refrences).
Also Josh you may just want to keep that message above handy for newbys like me....
03/19/2004 (1:40 am)
This is what I have been looking for, thanks I now have allot of material that I can probe & poke into. Ahh great, now I have more examples to look at and tweak!... :) Quote:-Dan Jones' Super Simple Torque Demo rocks for learning the absolute basics of setting up a GUI in Torque. Go to the page linked above and download the "supersimpletorquedemo.zip" file linked at the top of the page. Follow the instructions in the zip and you'll be on your way to doing useful things with TorqueScript. Also check out Dan's Super Simple Demo With a Console resource, also linked on the above page.
This is the one that I was basing my work off of in this thread, I could not find the refrence again after I started working.
I decided to see what I could find for Tuts and I have been doing the Codesamplers Tuts the last couple of hours, playing with triggers right now. Already made a tweak to, it shouts out to all players that I have entered into there area (already have insidious things that can be done to entering vic--- players) though the rest of the text does not come through...
I will have to spend time learning the engines script and studying it's behavoir. I like to poke and prod. :) see what I can come up with. But the great thing is that there are other people poking and proding to, who have been doing it for longer and thanks for this list!
For now I must go to sleep, it's 3am and I must sleep, it has been a productive night.
Thanks again for all of your help (all of the above) for providing help (and many refrences).
Also Josh you may just want to keep that message above handy for newbys like me....
#17
03/19/2004 (6:09 am)
Indeed. Josh should post this somewhere where it doesn't get lost :>
#18
should be added to the end of the .gui file after you have created all of your gui elements, more specificly after
03/19/2004 (6:11 am)
//--> RJY// Toke this from RW for now
$NUM_IMAGES = 10;
$imageExtent = "60 50";
for(%i=0; %i<$NUM_IMAGES; %i++){
%imagePos = (%i*65);
if( %i < 5 )
{
%image = new GuiBitmapCtrl("daImage" @ %i)
{
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "center";
position = %imagePos @ " 5";
extent = $imageExtent;
visible = 1;
bitmap = "game/client/ui/SomeImage";
helpTag = "0";
wrap = "0";
};
SomeControl.add(%image);
}should be added to the end of the .gui file after you have created all of your gui elements, more specificly after
//--- OBJECT WRITE END ---. As mentioned previously, everything within the {} of a gui element are properties of the gui element.
#19
And this? www.garagegames.com/index.php?sec=mg&mod=resource&page=category&qid=110
03/19/2004 (6:25 am)
Did you see this? www.garagegames.com/index.php?sec=mg&mod=resource&page=category&qid=115&qsf=post...And this? www.garagegames.com/index.php?sec=mg&mod=resource&page=category&qid=110
#20
The documentation is available for just about anything you need to know, you just need to be willing to spend a small amount of time finding it.
Hopefuly the documentation project that Alex is spearheading will reduce the amount of time spent "finding" documentation.
03/19/2004 (6:32 am)
There are also other resources that are not hosted on GG as well, I think Beffy has a few tutorials on his site as well as another site (codesampler?)The documentation is available for just about anything you need to know, you just need to be willing to spend a small amount of time finding it.
Hopefuly the documentation project that Alex is spearheading will reduce the amount of time spent "finding" documentation.
Torque Owner Harold "LabRat" Brown
for (%i=0;%i<=10;%i++) { // ** Do stuff }String Conversions
Torque treats pretty much everything as a string. So you can get some strange results with your math occasionally.
Variables
$var = Global Variable
%var = Local Variable
Switching
Torque supports most standard C/C++ switch statements