Home   Help Search Login Register  

Author Topic: (Timer) how to Check a==20  (Read 1686 times)

0 Members and 1 Guest are viewing this topic.

Offline sardaukar17

  • Members
  • *
(Timer) how to Check a==20
« on: 25 Aug 2009, 07:11:36 »
All I want to do is check ONCE if Timer==20 or any other number. I'll show you what I am working on it will explain better than I can.

Code: [Select]
#ReStart
Timer=30

#Timer
~1
timer=timer-1
?(timer==20): goto "Infantry"
?(timer==10): goto "Armor"
?(timer==1): goto "Air"
?(timer<=0): goto "ReStart"
goto "timer"

The actual timer will count down as desired but the check for "Infantry" hits every second. When 10 seconds hits I can get it to go to armor once and same with Air. I predict either I have the syntax wrong or (and this is probly the case) the == command only works to make Parameters equal to Parameters, and apparently numbers are not parameters. I read some interesting stuff that can be done in the Decription and I have read about a few other scripts that are Timers but with all that effort toward creating all these Boolean variables there isn't a simple way to check to see if a number is equal to another number? I even went as far as to try Reverse phsycology on it

Code: [Select]
#ReStart
Timer=30

#Timer
~1
timer=timer-1

?((timer>=21) AND (timer<=23)): goto "Infantry"
?((timer>=11) AND (timer<=13)): goto "Armor"
?((timer>=1) AND (timer<=3)): goto "Air"
?(timer<=0): goto "ReStart"
goto "timer"
This actually produces the same result as before... So I guess the question is.. How do I make parameters equal to numbers?
« Last Edit: 25 Aug 2009, 07:13:08 by sardaukar17 »

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: (Timer) how to Check a==20
« Reply #1 on: 25 Aug 2009, 07:58:12 »
I'm not sure but try to use the same upper/lower case always... I mean: use timer (with small T) always or use Timer (with big T) always and never mix.
Fix bayonet!

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: (Timer) how to Check a==20
« Reply #2 on: 25 Aug 2009, 08:23:53 »
Hmm, SQS and SQF are not case sensitive. The syntax is fine and the script should work as intended. Did you check the RPT for errors?
try { return true; } finally { return false; }

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re: (Timer) how to Check a==20
« Reply #3 on: 25 Aug 2009, 10:55:08 »
haven't tried it, but would _timer fix the problem?  I use a countup script and the variable is prefixed with _
my script
Code: [Select]
_count = 0
#Start
~1
_count = _count + 1
?(_count >= 1800): TimeUp = True
Goto "Start"

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: (Timer) how to Check a==20
« Reply #4 on: 25 Aug 2009, 11:14:00 »
@sardaukar17
Tested the first code sample and it works just fine here.. :dunno:
I used simple hints and goto "Timer" in each label and the timer works just fine..

Code: [Select]
#ReStart
Timer=30

#Timer
~1
timer=timer-1
player globalChat format ["%1",timer];
?(timer==20): goto "Infantry"
?(timer==10): goto "Armor"
?(timer==1): goto "Air"
?(timer<=0): goto "ReStart"
goto "Timer"

#Infantry
hint format ["Infantry label\n timer:%1",timer]
goto "Timer"

#Armor
hint format ["Armor label\n timer:%1",timer]
goto "Timer"

#Air
hint format ["Air label\n timer:%1",timer]
goto "Timer"
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline sardaukar17

  • Members
  • *
Re: (Timer) how to Check a==20
« Reply #5 on: 25 Aug 2009, 17:03:28 »
lol well whatever it was I was doing wrong I must have fixed when I posted it. :confused: It works now.
I appriciate the help. :clap: Atleast it's there for someone else to find if they need a simple timer. :good:

Lesson #432
Do not try to do any scripting when very tired