Home   Help Search Login Register  

Author Topic: Countdown Timer  (Read 1742 times)

0 Members and 1 Guest are viewing this topic.

Offline Bailey

  • Members
  • *
Countdown Timer
« 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-
« Last Edit: 30 Aug 2008, 10:11:22 by h- »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Countdown Timer / Jail West Only
« Reply #1 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.
« Last Edit: 30 Aug 2008, 12:53:32 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Bailey

  • Members
  • *
Re: Countdown Timer / Jail West Only
« Reply #2 on: 30 Aug 2008, 17:07:24 »
Thanks Spooner all good now ;)

EDIT (Spooner): Removed unnecessary quoting.
« Last Edit: 30 Aug 2008, 17:19:58 by Spooner »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Countdown Timer
« Reply #3 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...
« Last Edit: 30 Aug 2008, 17:21:36 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Supergrunt

  • Members
  • *
Re: Countdown Timer
« Reply #4 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