OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: The-Architect on 07 Feb 2007, 00:54:59

Title: Prolonged Twilight
Post by: The-Architect on 07 Feb 2007, 00:54:59
Ok I want to write a script that will prolong the twilight a little bit, maybe 10-15 minutes.

I was going to use the skiptime command and perhaps have a loop with a condition.
There'd be another script with a timer that would be for the condition in the first script.

Get me?

I have two issues. First, if I want to skip the time back a minute every minute for 15 minutes what would the skiptime value be?
Second, is there a way to write such a script tidily?

Code: [Select]
#Loop

? EndScript : GoTo "Exit"
~60
skiptime -whatevervalue
GoTo "Loop"

#Exit
Exit

Second script runs thus,

Code: [Select]
~900
EndScript = true
Exit
Title: Re: Prolonged Twilight
Post by: Mandoble on 07 Feb 2007, 09:15:33
whatevervalue = (24 - 1/60) to go to the previous minute of the next day.

You may try -1/60, but as far as I remember skiptime didnt work with negative values.

BTW, skipping a full minute would have weird visual effects every minute. You may try something smoother, each second jump one second backward in the next day 24 - 1/3600.
Title: Re: Prolonged Twilight
Post by: bedges on 07 Feb 2007, 11:16:46
also, you don't need a second timer script.

Code: [Select]
_limit = _time
#Loop

~1
skiptime - (1/900)

?(_time >= (_limit + 900)):exit
goto "Loop"

Title: Re: Prolonged Twilight
Post by: The-Architect on 07 Feb 2007, 12:41:11
I'm a little slow this morning.

How can I use fractions?
Title: Re: Prolonged Twilight
Post by: Planck on 07 Feb 2007, 13:33:27
Look at it as 1 divided by 900.


Planck
Title: Re: Prolonged Twilight
Post by: Mandoble on 07 Feb 2007, 13:45:53
skipTime accepts only hours, so you need to use fractions of hour to achieve second or minute "granularity".
skipTime 1 = 1 hour forward
skipTime 1/60 = 1 minute forward
skipTime 1/3600 = 1 second forward

As far as I remember skipTime does not accept negative values (you should try this anyway), so once a second is elapsed, the more "similar" second to the elapsed one is just 24 hours less a second ahead. That is, the very same previous second of the next day.