Home   Help Search Login Register  

Author Topic: Unitname not being passed  (Read 463 times)

0 Members and 1 Guest are viewing this topic.

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Unitname not being passed
« on: 23 Feb 2004, 22:14:33 »
Ive got a group of units, each one is called pg0, pg1, pg2 etc etc.  Each unit has;

[this]exec "scriptname.sqs" in their init.

_unit = _this select 0

#start

@ !alive _unit

~5

removeallweapons _unit

?_unit == pg0 :goto "pg0"
?_unit == pg1 :goto "pg1"
?_unit == pg2 :goto "pg2"
?_unit == pg3 :goto "pg3"
?_unit == pg4 :goto "pg4"
?_unit == pg5 :goto "pg5"
?_unit == pg6 :goto "pg6"
?_unit == pg7 :goto "pg7"
?_unit == pg8 :goto "pg8"
?_unit == pg9 :goto "pg9"

hint "premature exit"
exit

{etc etc}
[/size]


However, the script suffers from a bad case of premature exitation.  While I expected

_unit = _this select 0

would return the units name (eg. pg0 ) it instead returns its group designation (eg. WEST Alpha black 3).  Since the script doesnt check the variable _unit agasint WEST Alpha black 3, the script runs right through and exits.  Ive spent the last hour or two on this, and cant seem to get it working right.  Has anyone got any ideas?

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Unitname not being passed
« Reply #1 on: 23 Feb 2004, 22:23:44 »
Hmmm... Strange... Try:

? pg01 == _unit

so you turn it around. Prolly not the solution but worth a try.

:beat: *Gets Shot* :beat:

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Unitname not being passed
« Reply #2 on: 23 Feb 2004, 23:03:57 »
Sodding marvelous.

Swapping them around was the solution.  Turns out I found a script already written in the ed depot that just needed some altering.  But its still nice to know the solution.