Home   Help Search Login Register  

Author Topic: Up! Get Down! Help Please!  (Read 531 times)

0 Members and 1 Guest are viewing this topic.

Captain Winters

  • Guest
Up! Get Down! Help Please!
« on: 07 Mar 2003, 21:26:40 »
Well my first attemp at a script was going great, until this weekend when I go to test my script this error:

"  '_this = select |#|0'  "


"Hmmm..." I said Trying to answer it myself only resulted in a bad migrain! Here's the script:


_this = select 0  
#loop
this setUnitPos "Down"
~2
this setUnitPos "Up"
~5
this setUnitPos "Down"
~3
goto "loop"

exit






What's Wrong?! Check the picture for da error again!

Tanks!
« Last Edit: 07 Mar 2003, 21:27:43 by Captain Winters »

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Up! Get Down! Help Please!
« Reply #1 on: 07 Mar 2003, 22:07:32 »
Without pre-defining anything in the script, _this = the
array, calling the script.

e.g: [myguy] exec "script.sqs"   / _this will be myguy

_this select 0 is the first element of the array, then _this select 1, _this select 2 etc.

e.g: [myguy,mychopper,mylocation] exec "script.sqs"

_this select 0 will be myguy

_this select 1 will be mychop

_this select 2 will be mylocation

What you are doing is: _this = select 0
That doesn't make sense.

you should try: _whoever = _this select 0

then do:

_whoever setUnitPos "Down"
~2
_whoever setUnitPos "Up"
~5
_whoever setUnitPos "Down"
~3
goto "loop"

exit

hope this helps

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Up! Get Down! Help Please!
« Reply #2 on: 07 Mar 2003, 23:15:03 »
short and simple what chris death means:

You should put in

_unit = _this select 0

instead of

_this = select 0

Captain Winters

  • Guest
Re:Up! Get Down! Help Please!
« Reply #3 on: 08 Mar 2003, 02:55:53 »
Gracias!
Thanks I'm gonna try it out now! Thanks dOdOdOdS!

Tanks!

Captain Winters

  • Guest
Re:Up! Get Down! Help Please!
« Reply #4 on: 08 Mar 2003, 03:12:27 »
Hmmm... Okay well I tried everything but I got a new error!

" _this SetUnitPos "Down"|#|: Error setposunit: Typed Array Expected Object "

Thanks For The Help So Far, I'll give you the pic now. Help P-p-p-a-a-ease Help Me!

Tanks Guys!

Captain Winters

  • Guest
Re:Up! Get Down! Help Please!
« Reply #5 on: 08 Mar 2003, 03:16:42 »
OH sorry forgot the script:

_this = _this select 0
#loop
_this setUnitPos "Down"
~2
_this setUnitPos "Up"
~5
_this setUnitPos "Down"
~3
goto "loop"

exit


Tanks!

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Up! Get Down! Help Please!
« Reply #6 on: 08 Mar 2003, 12:44:58 »
Winters - the error is self-explaining in combination with
my complicated explanation above  ;D

_this = the array, calling the script

_this select 0 = the first element of the error, _this select 1
the second one, and so on


When using _this = _this select 0

_this is an array and you want to replace the array by
an element of the array.

e.g: [me,and,mybuddy] exec "script.sqs"

by default (without predefining variables in your script)
you have already 4 pre-defined variables here.

_this - this is the whole array, which called the script
           in our case now: [me,and,mybuddy]

_this select 0 - first element of the array
                        in our case: me

_this select 1 - second element
                        here: and

_this select 2 - third element
                        in our case: mybuddy

You cannot make: array = element, as you are doing above.
This is what causes your error message.

Just replace _this with anything else, and it should work.

_anythingelse = _this select 0

~S~ CD
« Last Edit: 08 Mar 2003, 13:21:50 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Captain Winters

  • Guest
Re:Up! Get Down! Help Please!
« Reply #7 on: 08 Mar 2003, 19:50:15 »
Okay. Works! Thanks!!


Tanks!

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Up! Get Down! Help Please!
« Reply #8 on: 08 Mar 2003, 20:16:03 »
tanks?! WHERE?!?! RUN!! ;D

 ;)
« Last Edit: 08 Mar 2003, 21:35:05 by The real Armstrong »

Captain Winters

  • Guest
Re:Up! Get Down! Help Please!
« Reply #9 on: 08 Mar 2003, 20:48:00 »
lol...  :)