Stuff Every Scripter Should Know
This is a compilation of things that made me say, "I wish in knew that when i started scripting", when i found out about them. Some of them may be obvious to people, but maybe some of them will make you say the same thing. If you think there should be something else on this list that isn't, send me an email.
This function call makes T2 write a file (gamedata/console.log) which contains everything that is displayed in the console. This can be invaluable when you are debugging, especially when used in combonation with trace();
setlogmode(true); turns it on and
setlogmode(false); turns it off;
This has got to be one of the most useful functions provided by dynamix. It basically provides you with a stack trace of what is going on in script land in T2. If you are trying to figure out exactly what happens when you press spawn, turn on trace, kill yourself, spawn, and turn it off. Then go to the console and look at what happened. If anyone knows of a way to dump a trace to disk, i will love you forever if you tell me how to do it.
trace(true); turns it on, and
trace(false); turns it off. you can use 1 and 0 instead of course.
Pretty much every object in tribes2 provides the
dump() method. What dump does, is echo to the console all the attributes, tagged attributes, and methods that the object provides. This is ridiculously useful when you are trying to figure out how to do stuff.
This function will recompile and load a script. When i'm working on something, i play in windowed mode (hit alt-enter), so i can still get a trusty old textpad. When stuff isn't working right, make changes to the file, and exec it. it'll recompile the script and you can try it again. This is great for fixing syntax errors. UberGuy[FT] posted a package that overrides the exec function so that it'll search through your base folder and add the path to the first instance of that file it finds. so to execute base/really/long/annoying/path/here/thinger.cs, you would only have to type
exec("thinger.cs");. You can get his code here. Just drop this file in your scripts/autoexec tree somewhere.
This is the first script file that gets executed, and pretty much tells you exactly how things are going to procede from when it's executed, to when you get in the game. it's in base.vl2, you should have a look over it. If you haven't extracted scripts.vl2 to a directory that you can get at pretty easily, you'll probably want to do that. if you don't already know, vl2 files are just zip files. you can associate them with winzip, or whatever and use that to open, extract and create them.
autoexec.cs is loaded quite early in the t2 script loading sequence. The only things that are executed before it are console_end.cs, scripts/controlDefaults.cs (default keybinds and game functions), prefs/MyConfig.cs (you keybind setup), and anything in the scripts/autoexec directory. I typically use autoexec.cs to turn on setlogmode(), and/or trace()