This command will find all members of a specified party and returns their
names (or character id or account id depending on the value of "type") into an
array of temporary global variables. There's actually quite a few commands
like this which will fill a special variable with data upon execution and not
do anything else.
Upon executing this,
Array | Description |
---|---|
$@partymembername$[] | is a global temporary string array which contains |
all the names of these party members (only set when type is 0 or not | |
specified). | |
$@partymembercid[] | is a global temporary number array which contains |
the character id of these party members (only set when type is 1). | |
$@partymemberaid[] | is a global temporary number array which contains |
the account id of these party members (only set when type is 2). | |
$@partymembercount | is the number of party members that were found. |
The party members will (apparently) be found regardless of whether they are
online or offline. Note that the names come in no particular order.
Be sure to use $@partymembercount to go through this array, and not
[[getarraysize]]', because it is not cleared between runs of
[[getpartymember]]'. If someone with 7 party members invokes this script, the
array would have 7 elements. But if another person calls up the [NPC], and
he has a party of 5, the server will not clear the array for you, overwriting
the values instead. So in addition to returning the 5 member names, the 6th
and 7th elements from the last call remain, and you will get 5+2 members, of
which the last 2 don't belong to the new guy's party. $@partymembercount
will always contain the correct number, (5) unlike [[getarraysize]]()' which
will return 7 in this case.
// get the party member names
[Getpartymember] [Getcharid](1),0;
// It's a good idea to copy the global temporary $@partymember*****
// variables to your own scope variables because if you have pauses in this
// script ([Sleep], [Sleep2], [Next], [Close2], [Input], [Menu], [Select], or [Prompt]),
// another player could click this NPC, trigger [[getpartymember]]', and
// overwrite the $@partymember***** [Variables#Global_Variables](Variables).
[Set] .@count, $@partymembercount;
[Copyarray] .@name$[0], $@partymembername$[0], $@partymembercount;
// list the party member names
[For] ([Set] .@i,0; .@i