Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Question about variables

Author
Message
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 17th Jan 2011 15:54
I have been scripting for fpsc for some time but since i started using DBpro i have wanted variables. I know that their is global variable but i don't understand how they work.

I know that their is 1 command one action(globalvar= and setvar=)
Im guessing set var sets the current global variable, but what does globalvar= do and can i have multiple global vars at the same time?

Srry about my english im from sweeden
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 17th Jan 2011 16:59
I think there is a tutorial on variables in the unoffical guide, but to sumarise:

There are 99 global variables already declared for you to use in your scripts

globalvar= tells the script which global variable you want to test or modify.

varequal=,varless, etc. perform tests on the global variable.
setvar=,incvar,decvar=, etc. modify the global variable.

For example:

:state=0:globalvar=53,setvar=5

This makes global variable 53 equal to 5.

:state=0:globalvar=44
:state=0,varequal=6:setvar=0

This sets global variable 44 to 0 if it originally equalled 6.

I hope that makes sense to you.

[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 17th Jan 2011 22:59
OK thanks

So the global var command tells the script wich variable to use until the command is called again?

Srry about my english im from sweeden
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 18th Jan 2011 06:50
In short = yes. It's best practice to keep declaring it just before you test or modify the variable though to make sure you are accessing the variable you intend to.

[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 18th Jan 2011 23:11
Ok thanks

Srry about my english im from sweeden

Login to post a reply

Server time is: 2024-11-24 13:54:15
Your offset time is: 2024-11-24 13:54:15