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 / Random time delays in scripts? How to?

Author
Message
Evil Robot
13
Years of Service
User Offline
Joined: 23rd Jan 2011
Location:
Posted: 7th Feb 2011 04:38
Is it possible to script random time delays?

Let say according to the script something happens after 30 sec plus a random number of between 0 to X seconds?

P.S I know how to use the timer in scripts (I believe so but want test it until tomorrow) but it is the randomness that I have no clue about which commands to use.
Ched80
14
Years of Service
User Offline
Joined: 18th Sep 2010
Location: Peterborough, UK
Posted: 7th Feb 2011 09:09
There are two methods I can think of.

One is to use the conditions "timergreaterthan=30000" and "random=X", but you'd have to experience with values of X to get the desired delay, but defining an exact delay range will be difficult.

The other method is to set up a variable called "DelayTime" and use "random=X" to set the variable to a value between 30 and 30+X for example if you want a random delay between 30 and 35:



Then you could use the variable as part of the timer condition:

:state=1,timergreaterthan=%DelayTime:state=2

I hope this helps.

[url="http://raptr.com/No_Turn_Right?src=em_forum"][/url]

Login to post a reply

Server time is: 2024-11-24 12:29:28
Your offset time is: 2024-11-24 12:29:28