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 / A simple scripting question.

Author
Message
IntRepid Bullet
13
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Australia
Posted: 26th Jul 2011 13:44
I'm a noob at scripting. I was sick of asking people how to do things, so I sat down, and started to study my ass off. And I must say, it's not as hard as I thought it would be. But I have run into one trouble...

I understand that :State=0 is true, as there are no commands or actions yet, but how do I get the next part, for example in the tutorial I'm reading he has this line in the script.

:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecore\text\pressentertouse.tga,hudname=useswitchprompt,hudhide=1,hudmake=display,state=10

How did he get the state=10 at the end? I can only see 7 conditions and actions.

Can someone give me a breaf explination?

Thankyou!

Yeh, I'm a noob. <3
maho76
13
Years of Service
User Offline
Joined: 31st May 2011
Location: universe-hub, playing the flute
Posted: 26th Jul 2011 16:03 Edited at: 26th Jul 2011 16:06
link to a state that doesnt exist is a proper method to not destroy the script but running it to nothing so it doesnt loop on its own (what would happen if you dont use the nonexisting state, it would automatically get into the next line).
in this case: the hud would restart over and over again and so flicker.
very usefull wenn you use etimerstart-actions in a row, without it the etimer would start over and over again and would not result to anything (just an example).
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 26th Jul 2011 16:30 Edited at: 26th Jul 2011 16:39
Quote: "How did he get the state=10 at the end? I can only see 7 conditions and actions."


state=x is telling it what state the entity's script is in.
It is not a count of the actions or condidtions within a state and it can be 2, 6, 10, 30, etc.
For example...

:state=0:state=1

:state=1,plrwithinzone=1:state=2

:state=2,plrwithinzone=0:state=1

...as you can see we start at state=0, which is the initialization state.
In this example it simply tell the script to put the entity in a state of 1.
So, now the script will execute the line with the state=1 condition, because that is now true.
It will ignore the other lines because we are not in those states, so those lines first condidtion is not true, so those lines get ignored.

Now, in the line where state=1 was a condidtion, it was true so the script checks the next condition for the line, which is plrwithinzone=1.
If that condition is also true, then the script will execute the actions after the second colon, which in this case simply changes the state value again.
So, if the player is in the zone, then the state=2 action gets executed and now the script will run that line and ignore the others.
Really it is reading all the lines, but the others get ignored because their first condition (the state=x) is not true.

At this point the script's state value = 2 so since that condition is met it will check that lines next condition, which is plrwithinzone=0.
Now we stay in that state until the player leaves the zone, then that condition is also true and the actions after the colon would be executed.
Which in this example simply puts us back at state=1, so we loop.

This script does nothing but loop, so you would need more actions to make it do anything, but hopefully it is enough for you to grasp the use of the state=x condition.

Also, you can omit that condition for a stateless line like ...

:activated=1:activate=2,state=30

In this case the script would jump to state=30 if the activation is 1, regardless of whatever state it might be in since we had no state=x condition in the line.
Note that in this line example we also change the activation to 2 so the line will not become and endless loop and get stuck there.

I hope this helps.

Login to post a reply

Server time is: 2024-11-24 06:42:04
Your offset time is: 2024-11-24 06:42:04