Page 1 of 1
Just a n00b question
Posted: Sat Jul 17, 2004 8:01 pm
by Runt
Why are those "{" and "}" Needed in scripts ?
Posted: Sat Jul 17, 2004 8:42 pm
by blue60007
They are containers.
Say you have an if statement:
Code: Select all
if(level.somevar==1)
{
//do this
//then that
//and finally this
}
Put code in them following something like that, this way the engine knows what code goes with it.
I'm not sure if the Q3 engine works like this or not, but if you have one line of code with it you can do:
Somethings that works on, others it doesn't. The script is based on C++, and that works in C++, but I'm not 100% sure if it works in MOHAA script.
Posted: Sun Jul 18, 2004 4:32 am
by Bjarne BZR
A lot of commands ( like if, while and for ) decides what happens to the next statement... and it you do not use { & } the next statement is the next line... if you want any of these control statements to controle more than one line, you need to enclose the lines with a { & a }....
Posted: Sun Jul 18, 2004 9:38 am
by Runt
ok thx for helping
*edit* oh forgot to ask :
Why are these :: in scripts?
Posted: Sun Jul 18, 2004 3:29 pm
by lizardkid
when you call an exec or thread statement from anotehr script off from the one you're writing, like so
exec global/ai.scr
sometimes you need to only cal a specific thread. so to spawn something the easy way...
thread global/ai.scr::spawnset 1
1 2 3
1. the command, only calls oen thread.
2. the path for the script. global is the generic path.
3. the thread in the ai.scr to call.

Posted: Sun Jul 18, 2004 3:34 pm
by Runt
But why it doesn't work like this:
thread global/ai.scr spawnset 1
Posted: Sun Jul 18, 2004 3:40 pm
by lizardkid
it's all syntax mate. don't question it, compilers and computer language need keywords and stuff. we don't make the rules.

Posted: Sun Jul 18, 2004 3:45 pm
by Runt
lol ok
