Home   Help Search Login Register  

Author Topic: Syntax bug... help me squash it ...please.  (Read 785 times)

0 Members and 1 Guest are viewing this topic.

Offline Burn

  • Members
  • *
Syntax bug... help me squash it ...please.
« on: 09 Jul 2003, 10:46:58 »
Hi all :wave:... just another of my syntax probs here again ;) take a look at this little buggy thing:
Code: [Select]
_law = wglaw

_law SetCombatmode "RED"
_law SetBehaviour "COMBAT"
_law SetSpeedMode "FULL"

#killrmor
"_x reveal rmor" foreach units _law
"_x domove getpos rmor" foreach units _law
"_x doTarget rmor" foreach units _law
~60

(count crew rmor > 2) or (getdammage rmor < 0.6):goto "killrmor"
(count crew rmor < 2) or (getdammage rmor > 0.6):goto "killbmp"

#killbmp1
"_x reveal bmp1" foreach units _law
"_x domove getpos bmp1" foreach units _law
"_x doTarget bmp1" foreach units _law
~10

(count crew bmp1 > 2) or (getdammage bmp1 < 0.6):goto "killbmp1"
(count crew bmp1 < 2) or (getdammage bmp1 > 0.6):goto "killbmp2"

#killbmp2
"_x reveal bmp2" foreach units _law
"_x domove getpos bmp2" foreach units _law
"_x doTarget bmp2" foreach units _law
~10

(count crew bmp2 > 2) or (getdammage bmp2 < 0.6):goto "killbmp2"
(count crew bmp2 < 2) or (getdammage bmp2 > 0.6):goto "killbmp"

#killbmp
"_x reveal bmp" foreach units _law
"_x domove getpos bmp" foreach units _law
"_x doTarget bmp" foreach units _law
~60

(count crew bmp > 2) or (getdammage bmp < 0.6):goto "killbmp"
(count crew bmp < 2) or (getdammage bmp > 0.6) && (count crew bmp1 < 2) or (getdammage bmp1 > 0.6) && (count crew bmp2 < 2) or (getdammage bmp2 > 0.6) && (count crew rmor < 2) or (getdammage rmor > 0.6):goto "follow"

#follow
[ap, at, 10, 5, 3] exec "follow.sqs"

exit

There's something wrong with the count crew thingy, but I don't know what... anyone know ???
Thanks in advance loons ;D :o :P ;D

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:Syntax bug... help me squash it ...please.
« Reply #1 on: 09 Jul 2003, 11:08:42 »
Well, your script is very specific to the units you have created, so it's hard to test it.

Two remarks, though :

1) There is no question mark each time you test the number of "rmor" :

Code: [Select]
(count crew rmor > 2) or (getdammage rmor < 0.6):goto "killrmor"
(count crew rmor < 2) or (getdammage rmor > 0.6):goto "killbmp"

should be :

Code: [Select]
? (count crew rmor > 2) or (getdammage rmor < 0.6):goto "killrmor"
? (count crew rmor < 2) or (getdammage rmor > 0.6):goto "killbmp"

2) What happens when crew rmor is equal to 2 ? Shouldn't you add a "=" somewhere ?



« Last Edit: 09 Jul 2003, 11:09:23 by Igor Drukov »

Offline Burn

  • Members
  • *
Re:Syntax bug... help me squash it ...please.
« Reply #2 on: 09 Jul 2003, 14:28:54 »
Quote
What happens when crew rmor is equal to 2 ? Shouldn't you add a "=" somewhere ?
You mean like this?:
Code: [Select]
? (count crew rmor >= 2) or (getdammage rmor < 0.6):goto "killrmor"Thanks for the help Igor! :thumbsup:

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:Syntax bug... help me squash it ...please.
« Reply #3 on: 09 Jul 2003, 14:45:54 »
Yes that's what I meant.

 :cheers:

Offline Burn

  • Members
  • *
Re:Syntax bug... help me squash it ...please.
« Reply #4 on: 09 Jul 2003, 17:32:47 »
I finally got home and tested it, and it seems to work :D (atleast no error mesages ::)).
Thanks a lot Igor I owe you one ;) :thumbsup:
 :cheers: