OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Bailey on 29 Aug 2008, 19:03:50

Title: Countdown Timer
Post by: Bailey on 29 Aug 2008, 19:03:50
Code: [Select]
#start
_timer = 0

#loop
_timer = _timer+1
Titletext [Format [" %1", _timer],"plain down"]
? timer <= 300: exit
? StopScript : exit
~1
goto "loop"

Ok hello first of all  :good:

#1 On to the job at hand, My script timer works the first time i set it off but once i turn it off with a trigger "StopScript = true" and activate it again it will not time through again. It gets stuck on 1.


#EDIT: Edited the topic title as well..   h-
Title: Re: Countdown Timer / Jail West Only
Post by: Spooner on 29 Aug 2008, 19:47:05
You increment _timer (local variable), but check timer (global variable). You also need to exit if _timer is too large, not when it is too small:
Code: [Select]
? _timer >= 300: exit
I suspect that after you first run the script, you do set the value of timer and that causes the script to exit early (that line will be ignored if timer is undefined).

One topic per thread please (where you have multiple questions about a specific subject, that can be O.K.)! Edit your original post to remove the jail question and start a new thread with it.

EDIT: Thanks for sorting that out.
Title: Re: Countdown Timer / Jail West Only
Post by: Bailey on 30 Aug 2008, 17:07:24
Thanks Spooner all good now ;)

EDIT (Spooner): Removed unnecessary quoting.
Title: Re: Countdown Timer
Post by: Spooner on 30 Aug 2008, 17:18:37
Please don't quote the previous post. Everyone knows you are replying to it ;P

Don't worry about making forum faux pas. You'll get the hang of it...
Title: Re: Countdown Timer
Post by: Supergrunt on 01 Sep 2008, 13:25:15
how do i call this script with a set time in wich my unit has to complete the mission

can this script be made just like the ofp one 
setting variables to show the time once in a certain while (players decision how often the timer is shown) until the last minute or so then shows constant