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 / Why do variables always activate on their own?

Author
Message
A dude
14
Years of Service
User Offline
Joined: 15th Mar 2010
Location: The Solar System
Posted: 10th Jan 2014 22:25 Edited at: 10th Jan 2014 22:27
Maybe it's just me but in every version I try, variables always activate by themselves. Here's an example:

Even if I don't enter the zone, the var gets activated. Is that supposed to happen? If so, what's the point of that?
I'm using the latest official beta with s4real's latest unoffical fpscgame.exe.

Don't waste your life
Corno_1
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 11th Jan 2014 01:07
Maybe I am totally wrong, so do not take this as a fact:

After my opinion, every compiler generate a variable when he compiles, so if you start your game, the game already knows that the var exist. What the point of it is, i didnĀ“t know. Maybe something that static things like variable names not must calculate dynamic which would waste resources.

But what is your problem with that?

Games make the world better
A dude
14
Years of Service
User Offline
Joined: 15th Mar 2010
Location: The Solar System
Posted: 11th Jan 2014 02:03
Let's say we want a variable to activate a switch when the player enters a zone. We don't want the switch to activate before he does anything.

Don't waste your life
BlackFox
FPSC Master
15
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 11th Jan 2014 03:24
The reason is simple. You initialized the variable "hi" and then used the "setvar=hi" without a value. By default, variables set to 0, so by using "setvar=hi" you have in fact set the variable to 0.

You would need to initialize your variable with the "dimvar=hi", then have a script to set the variable "hi" to the value you want in order for the switch to become useable. So (for example), I would initialize the "hi" variable, then have a script the player interacts with (such as picking up something) and that pickup script would use the "setvar=hi 1" (sets he variable hi to a value of 1). Then when I approach the remote, the door remote switch script would check the variable and if the value was at "1" I can use the remote to open the door:



I use this method in v1.17 flawlessly.

There's no problem that can't be solved without applying a little scripting.
A dude
14
Years of Service
User Offline
Joined: 15th Mar 2010
Location: The Solar System
Posted: 11th Jan 2014 03:32
I see now. Thanks.

Don't waste your life

Login to post a reply

Server time is: 2024-03-29 05:22:19
Your offset time is: 2024-03-29 05:22:19