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 / Bah now why won't this script work?

Author
Message
Frag Monkey
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 5th Mar 2007 00:31 Edited at: 5th Mar 2007 00:32
Well here I go asking another question about scripting. I just can't seem to get a single script working without asking here on the forums but I am learning.

Anyway, I'm trying to make a script for a sound zone that when the player is in the zone, the sound plays for about 7 seconds and then stops...



Thank you for your time...
tyrano man
18
Years of Service
User Offline
Joined: 26th Oct 2006
Location: Battle City - Kalspher :)
Posted: 5th Mar 2007 22:22
I am not sure, but as I know there is only one global timer, that means that when you get to the zone, the time is already past 7.5 seconds.

I'm not sure, as i don't like timers, but I think that is correct.
Good luck with your script
Tyrano

Woot Kingdom hearts owns!
Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 5th Mar 2007 23:16
Quote: "Anyway, I'm trying to make a script for a sound zone that when the player is in the zone, the sound plays for about 7 seconds and then stops..."


Because that's what you've said in your script. 1000 is equal to one second so 7500 is equal to around 7 and a half seconds. What exactly did you want it to do?


xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 5th Mar 2007 23:38
Quote: ":state=0,plrwithinzone=1,sound=$0,timerstart:state=1"


The problem is that sound= and timerstart are actions, not conditions and therefore belong after the second colon.

:state=0,plrwithinzone=1:sound=$0,timerstart,state=1

Best.

I'm sorry, my answers are limited. You must ask the right question.

Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 6th Mar 2007 00:11
Sorry for the brief hijacking of your thread Frag but xplosys, I haven't really tried scripting yet so I'm not sure about actions and conditions but the line you stated, does it mean:

"start at state 0,if player is within the triggerzone: play the sound that's in sound0 in the properties, start the global timer then goto state 1"?


xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 6th Mar 2007 03:58 Edited at: 6th Mar 2007 04:28
If state=0 [true when script is initialized] and the player is within the zone then play sound $0, start the timer and change state to 1.

Think of state as a container which holds a global variable. When the script first runs, the variable is initialized at zero, so state=0 is true, or not false.

We tend to think that the engine reads each line of a script over and over again until it finds a condition which is true, but in reality it looks for a condition which is not false, which is why the following works.

::sound=$0,destroy

The first colon can be thought of as "IF", and the second colon can be thought of as "THEN". Coma's [,] can be thought of as "AND". In the example, there is no condition to test and since nothing is false, the engine moves on to the action portion of the statement and destroys the entity.

There is no goto, but the engine continues to read each statement in sequence until it finds another condition which is not false. When it does, it executes the actions. So when the variable in STATE is changed to 1, the engine will continue to read each line stopping and executing the one which contains STATE=1, if it finds no other false conditions in that line.

Very simply put, IF this AND that is not false, then do this AND that. Changing the STATE value allows us to progress the script in a given sequence to fit our needs.

Best.

I'm sorry, my answers are limited. You must ask the right question.

Login to post a reply

Server time is: 2024-11-23 12:55:50
Your offset time is: 2024-11-23 12:55:50