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 / Can scripts go to more than one state at a time?

Author
Message
Snipesoul
17
Years of Service
User Offline
Joined: 29th Aug 2007
Location: Somewhere in New York...
Posted: 1st Apr 2010 19:59
Even though I probably wouldn't find any use for this, I was just curious and wondering if scripts can go to more than one state at a time... example:


"Dad? Dad, I'm a- Ye- Not a "crazed gunman", dad, I'm an assassin! ...Well, the difference bein' one is a job and the other's mental sickness!" - The Sniper.
Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 3rd Apr 2010 15:28
No and I can't really see why you would want to.

You could however set an entities local variables

e.g.



So that the entities local variables 1 and 2 were set to 1 and 2 respectively.
GHILLI
14
Years of Service
User Offline
Joined: 8th Apr 2010
Location: U.S.A.
Posted: 10th Apr 2010 19:35
actually while working on an ally AI script i found a use for that - I needed my Ally to obey orders regarding movement as well as orders regarding attacks. So there would be use for it, but yeah u can just use local variables

"The road to Hell is paved with good intentions."
Les Horribres
19
Years of Service
User Offline
Joined: 20th Nov 2005
Location: My Name is... Merry
Posted: 11th Apr 2010 12:14
Oh, even COOLER! Local variables!


GHILLI you need to understand what your script actually does

if (state == 1) action();
if (state == 2) anotherAction();

"state" is actually a variable. In fact, given we now have local variables... state is actually a retro thing that older scripters use. But it is a variable none the less.

When reading your script, you should recognize that any change or reassignment of said variable will cause a condition to fail thus forth


:state=0,timergreater=5000:state=1
:state=0,timergreater=5000:state=2

if (state == 0) {
if (timer > 5000) {
state = 1;
}
}

// state is now equal to 1
if (state == 0) {
if (timer > 5000) {
state = 2;
}
}

//condition is false because state != 0

Its not who you are or what you've done... its WHY you did it and how far you are willing to go.
If you fear speaking for yourself, make use the words of others while discovering your own voice.
GHILLI
14
Years of Service
User Offline
Joined: 8th Apr 2010
Location: U.S.A.
Posted: 12th Apr 2010 22:31
I know that state is a variable that tells FPSC which loop of commands to run/use/execute. BUT being able to go to more than one state at a time would be like using "or" in the code:


if (state=1)or(state=3)
{
commands;
}

(I know that's not proper C++ I'm just trying to get my point across)

Basically what that means is that if state is equal to one OR if state is equal to 3 then use this loop of commands/actions - really all it would do is save the "script-er" some time by not requiring them to apply the same conditions and actions to multiple states. And yes i do realize that it is not "technically" going to 1+ state at one time but if you think about it, it is in a way.

- GHILLI

"The road to Hell is paved with good intentions."

Login to post a reply

Server time is: 2024-11-25 02:09:17
Your offset time is: 2024-11-25 02:09:17