Home   Help Search Login Register  

Author Topic: Newbie needs help with "JOIN" command  (Read 606 times)

0 Members and 1 Guest are viewing this topic.

Shrapper

  • Guest
Newbie needs help with "JOIN" command
« on: 18 Jan 2003, 00:54:32 »
All,

   I've read through all the basic tutorials and have written a few simple, working scripts.  My problem with is with the JOIN command. I simply can not get it to work.  Here is the scenario:

I have made a mission on the intro island with two units and one trigger

1st Unit - Group named "rescue" (leader is 'player' type)

2nd Unit - Unit named "pilot". He does not have a connection line to "rescue".

Trigger - A 10 by 10 Ellipse set to go off when entered by "WEST".  Neither unit starts in this ellipse.  Condition field = "This". Activation field = "[] exec "rescue.sqs""

Here is my "rescue.sqs" file (which is located in the correct folder, btw)

;Rescue.sqs
;This script will force the downed pilot to join the rescue group.

;Command for pilot to join group

pilot Join rescue

;test text to make sure the script is working
TitleText ["The rescue.sqs script is running!", "plain down"]

exit

Both units are named in all lowercase.

Here is the error the editor prints.

'pilot join rescue |#|': Error type object, expected array.

Any help would be appreciated. To be unable to get a simple command like this to work is EXTREMELY frustrating!  I really want to get this to work.  Thanks in advance.

Shrapper

Offline Blanco

  • Former Staff
  • ****
Re:Newbie needs help with "JOIN" command
« Reply #1 on: 18 Jan 2003, 01:01:01 »
try

[pilot] join Leader rescue

Search or search or search before you ask.

Shrapper

  • Guest
Re:Newbie needs help with "JOIN" command
« Reply #2 on: 18 Jan 2003, 01:14:59 »
Blanco, thank you for the quick (and correct) response.  What absolutely kills me is that NOWHERE in any of the sources that I read does it state that you need the brackets around the object that will do the joining. The example below is right from the command reference:

Quote
Command :
Join
 
Description :
Causes selected unit to join specified group.
 
Syntax :
UnitName Join GroupName

UnitName is the name of the unit to join a group.
GroupName is the group the unit should join. Use GrpNull to take a unit out of a group.
 
Returns :
N/A
 
Example :
MyGuy Join BigGroup
MyGuy Join GrpNull
MyGuy Join group OtherGuy

Being able to draw on those who "have been in the trenches" is much appreciated.  Well, off to make my first mission.  Thanks again.

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Newbie needs help with "JOIN" command
« Reply #3 on: 18 Jan 2003, 23:25:16 »
Sorry Shrapper, just unsolved this for a second to highlight something for you ;)

It does say in the comref that you need the brackets:

Code: [Select]
unitArray join group
Operand types:
    unitArray: Array
    group: Object or Group
Type of returned value:
    Nothing
Description:
    Join all units in the array to given group. Note: total number of group members must not exceed 12. Note: This function is unsupported in MP in version 1.33 and before.

You see there is a big difference between unitname and unitarray.

An array is what uses the square brackets. Hence to have a unit array, your list of units (even if it's only one) must have square brackets around it.

Just thought I'd point that out to all wondering about it ;)