Home   Help Search Login Register  

Author Topic: thisselect  (Read 790 times)

0 Members and 1 Guest are viewing this topic.

_Ross_

  • Guest
thisselect
« on: 18 Aug 2003, 21:02:29 »
what does the thisselect command do? i see it everwhere and i can figure it out, help?


thanks :toocool:

Agent Fire

  • Guest
Re:thisselect
« Reply #1 on: 18 Aug 2003, 21:07:31 »
that's weird - i can't find it in the unofficial command reference

Drozdov

  • Guest
Eh?
« Reply #2 on: 18 Aug 2003, 21:32:41 »
Are you sure it's called thisselect? I've never heard of such a command...  ???

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:thisselect
« Reply #3 on: 18 Aug 2003, 21:43:18 »
Select is a command.    You use it to extract elements from an array - check the Command ref.

Obviously you have to define the array, and that's all that the "this" is doing.   So

this select 0

means extract the first member of this array.  

For example, if you called a script with

[X,Y] exec "myscript.sqs"

where X and Y are some parameters, you could start the script
 with

_unit = this select 0
_weapon = this select 1

which would mean that the local variable _unit would take the value of X and _weapon would take the value of Y.

That's probably not very clear, but I hope it helps.    
Plenty of reviewed ArmA missions for you to play

_Ross_

  • Guest
Re:thisselect
« Reply #4 on: 18 Aug 2003, 23:49:09 »
 thanks but how do you use it with coordinates?
my friend made a scud script naming the x any y coordinateds as aim1 and aim2. after he did that, he could position the game logics perfectly. how do i name the coordinates of something?

SheepOnMintSauce

  • Guest
Re:thisselect
« Reply #5 on: 19 Aug 2003, 00:40:00 »
Using :

_aim1 = this select 0
_aim2 = this select 1

I imagine. Using [aim1,aim2] exec "nameofscript.sqs" then to initiate the script. aim1 and aim2 would be your co-ordinates.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:thisselect
« Reply #6 on: 19 Aug 2003, 00:57:20 »
getpos loon1 select 0

returns the x coordinate of loon1.
Plenty of reviewed ArmA missions for you to play

SheepOnMintSauce

  • Guest
Re:thisselect
« Reply #7 on: 19 Aug 2003, 01:04:59 »
Quote
getpos loon1 select 0

returns the x coordinate of loon1.

So getpos loon1 select 1 would be the y coordinate of loon1?

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:thisselect
« Reply #8 on: 19 Aug 2003, 02:34:28 »
You've got it :)

From the Official Command Reference:
Quote
array select index

Operand types:
    array: Array
    index: Number
Type of returned value:
    Any Value
Description:
    select index element of array, index 0 denotes the first element, 1 the second

Example:
    [1, 2, 3] select 1 , result is 2

So basically, if you've got an array... say:

[a, b, c]

Then array select 0 would be: a
array select 1 would be: b
and array select 2 would be: c

(Just note that the numbering starts from 0, not 1).

So using that in the style of co-ordinates, we've got:

[x, y, z]

So select 0 is your East-West co-ord, select 1 your North-South co-ord, and select 2 your Vertical component.

Hope that helps you out a bit ;)

_Ross_

  • Guest
Re:thisselect
« Reply #9 on: 19 Aug 2003, 05:16:47 »
ok thanks guys im got it now