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 / need a litle help with a timer script.....who helps to find what's wrong?

Author
Message
joeganzi
14
Years of Service
User Offline
Joined: 25th Feb 2010
Location:
Posted: 1st Mar 2011 23:02 Edited at: 1st Mar 2011 23:03
Hi,
I've made a timer script that play a sound and show a message after changing the ambient lights.
It works great but I don't know why the huds don't desapeare and still there.....I tried something else but nothing.....
do you know why?

;Artificial Intelligence Script

;Header

desc = ambient light and timer message

;Triggers

:state=0:timerstart,state=1
:state=1,timergreater=5000:sound=audiobank\user\ringing.wav,state=10
:state=10:ambience=20,ambiencegreen=10,ambiencered=25,ambienceblue=10,state=11
:state=11:hudreset,hudx=50,hudy=90,hudimagefine=myhuds\lightsoff.png,hudname=lightsoff,hudhide=1,hudmake=display,state=5
:state=5:hudshow=lightsoff,timerstart,state=8
:state=8,timergreater=8000:hudfadeout=lightsoff
BlackFox
FPSC Master
16
Years of Service
User Offline
Joined: 5th May 2008
Location: Knight to Queens Bishop 3
Posted: 1st Mar 2011 23:16 Edited at: 1st Mar 2011 23:27
Your syntax is not quite right. Your hud is defined in the top, usually :state=0 and then the rest of the script follows. So try this:



Have not tested, but I reorganized the syntax structure for you.

- BlackFox

The function of good software is to make the complex appear to be simple.
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 1st Mar 2011 23:25
You need to add one more state= action to the last line so you have something like:


Without the laste "state=9" the last line is repeated over and over again and since the script action "hudfadeout=" starts by displaying the hud, your hud ends up being constantly displayed.

I would also move your hud creation line "state=11:..." to the front of your script on an additional "state=0:..." line. This would make your script much more efficient (if you decide to loop you script). HUDs only needs to be created once and then can be shown and unshown as many times as you want.

I would also change the way you use 'state='. Your current method is very confusing and (when your scripts get bigger) wll end up being very difficult to debug if you continue in this way.

My advice would be to go up in 10s or 100s. The state of an fpi can be a massive number so do not worry about running out of numbers - you wont. Incrementing state in 10, however, makes it much easier to debug your scripts in future.

So using this method, your script could look something like this:



[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 1st Mar 2011 23:29 Edited at: 1st Mar 2011 23:34
Basically the same as what BlackFox come up with. Only real change is the use of etimer in place of timer.



Edit: Also moved the hudfadeout to the hudshow line. Don't really know if that matters.

joeganzi
14
Years of Service
User Offline
Joined: 25th Feb 2010
Location:
Posted: 1st Mar 2011 23:43
Perfect!
so be ordinated helps!
I'm always a bit disordinated when I create scripts 'cause everytime I add something or change them.....I'd like to post it one very big (that works) but it's a big mess just to make you laught! ))

Anyway I'll try to follow your tips!
ah btw now the script works great!

thanks!

Login to post a reply

Server time is: 2024-11-24 11:53:06
Your offset time is: 2024-11-24 11:53:06