Page 1 of 1
Script structure confuse me
Posted: Sat Jul 30, 2011 8:36 pm
by santipi
Good day,afternoon,night fellows
,see my after 2 weeks studing scripts i got stuck with a problem:
-if i flollow the manual scripting look like this:
but if i follow the web/scriptsamples of rf looks like this:
Code: Select all
{
FOV[xxx]
Spawn[()
{
SetFOV(FOV);
...
so my question is,Is the manual outdated or the 2 ways work exacly the same just writed diferent?
Re: Script structure confuse me
Posted: Sat Jul 30, 2011 10:54 pm
by QuestOfDreams
These two versions are equivalent. The first one is specifying the float value directly in the method call. The second one declares a variable named FOV that holds this very value and is then used in the method call.
Re: Script structure confuse me
Posted: Sun Jul 31, 2011 12:24 pm
by santipi
pheww,i really apreciate the answer,that problem was eating me allready thanks a lot
Re: Script structure confuse me
Posted: Tue Aug 02, 2011 6:49 pm
by Nighthawk_0973
And if anybody doesn't understand what he said (for some reason) here's a more descriptive version:
(I don't know if the double slash indicates a comment in RF scripting but who cares it's just my way of pointing out specific lines in the middle of the code)
Code: Select all
{
Spawn[() //starts the spawn command
{
SetFOV(xxx); //sets the FOV to 'XXX'
...
simple right? Well let's take a look at the other one
Code: Select all
{
FOV[xxx] //creates a variable called 'FOV' with the value of 'XXX'
Spawn[() //starts the spawn command
{
SetFOV(FOV); //sets the FOV to the value of the variable 'FOV'
...
Therefore it's the same effect, but changing the code is easier because you can go and change the variables value, which variables are typically at the top of the code, and the FOV of the pawn will change, but you don't have to go digging through the code too much.
Sorry if that seemed a bit rediculous (how I answered a question that had already been answered and person who needed help understood it just fine) I just have a habbit of explaining things in higher detail if they aren't already, provided I understand whats going on of course...