<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.herc.ws/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.herc.ws/w/index.php?action=history&amp;feed=atom&amp;title=Getpartymember</id>
		<title>Getpartymember - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.herc.ws/w/index.php?action=history&amp;feed=atom&amp;title=Getpartymember"/>
		<link rel="alternate" type="text/html" href="https://wiki.herc.ws/w/index.php?title=Getpartymember&amp;action=history"/>
		<updated>2026-05-01T10:05:17Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21.11</generator>

	<entry>
		<id>https://wiki.herc.ws/w/index.php?title=Getpartymember&amp;diff=382&amp;oldid=prev</id>
		<title>Via: Created page with &quot;== Syntax == * getpartymember &lt;party id&gt;{,&lt;type&gt;};  == Description == This command will find all members of a specified party and returns their names (or character id or a...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.herc.ws/w/index.php?title=Getpartymember&amp;diff=382&amp;oldid=prev"/>
				<updated>2013-06-09T05:20:57Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Syntax == * &lt;a href=&quot;/wiki/Getpartymember&quot; title=&quot;Getpartymember&quot;&gt;getpartymember&lt;/a&gt; &amp;lt;party id&amp;gt;{,&amp;lt;type&amp;gt;};  == Description == This command will find all members of a specified party and returns their names (or character id or a...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Syntax ==&lt;br /&gt;
* [[getpartymember]] &amp;lt;party id&amp;gt;{,&amp;lt;type&amp;gt;};&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
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 &amp;quot;type&amp;quot;) 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.&lt;br /&gt;
&lt;br /&gt;
Upon executing this,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!Array&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| '''$@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).&lt;br /&gt;
|-&lt;br /&gt;
| '''$@partymembercid[]''' || is a global temporary number array which contains the character id of these party members (only set when type is 1).&lt;br /&gt;
|-&lt;br /&gt;
| '''$@partymemberaid[]''' || is a global temporary number array which contains the account id of these party members (only set when type is 2).&lt;br /&gt;
|-&lt;br /&gt;
| '''$@partymembercount''' || is the number of party members that were found.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The party members will (apparently) be found regardless of whether they are online or offline. Note that the names come in no particular order.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Example 1 ===&lt;br /&gt;
 // get the party member names&lt;br /&gt;
 [[getpartymember]] [[getcharid]](1),0;&lt;br /&gt;
 &lt;br /&gt;
 // It's a good idea to copy the global temporary $@partymember***** &lt;br /&gt;
 // variables to your own scope variables because if you have pauses in this &lt;br /&gt;
 // script ([[sleep]], [[sleep2]], [[next]], [[close2]], [[input]], [[menu]], [[select]], or [[prompt]]), &lt;br /&gt;
 // another player could click this NPC, trigger '[[getpartymember]]', and &lt;br /&gt;
 // overwrite the $@partymember***** [[Variables#Global_Variables|variables]].&lt;br /&gt;
 [[set]] .@count, $@partymembercount;&lt;br /&gt;
 [[copyarray]] .@name$[0], $@partymembername$[0], $@partymembercount;&lt;br /&gt;
 &lt;br /&gt;
 // list the party member names&lt;br /&gt;
 [[for]] ([[set]] .@i,0; .@i &amp;lt; .@count; [[set]] .@i, .@i+1) {&lt;br /&gt;
 	[[mes]] (.@i +1) + &amp;quot;. ^0000FF&amp;quot; + .@name$[.@i] + &amp;quot;^000000&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 [[close]];&lt;br /&gt;
&lt;br /&gt;
=== Example 2 ===&lt;br /&gt;
&lt;br /&gt;
 [[set]] .register_num, 5; // How many party members are required?&lt;br /&gt;
 &lt;br /&gt;
 // get the charID and accountID of character's party members&lt;br /&gt;
 [[getpartymember]] [[getcharid]](1), 1;&lt;br /&gt;
 [[getpartymember]] [[getcharid]](1), 2;&lt;br /&gt;
 &lt;br /&gt;
 [[if]] ( $@partymembercount != .register_num ) {&lt;br /&gt;
 	[[mes]] &amp;quot;Please form a party of &amp;quot;+ .register_num +&amp;quot; to continue&amp;quot;;&lt;br /&gt;
 	[[close]];&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 // loop through both and use '[[isloggedin]]' to count online party members&lt;br /&gt;
 [[for]] ( [[set]] .@i, 0; .@i &amp;lt; $@partymembercount; [[set]] .@i, .@i +1 )&lt;br /&gt;
 	[[if]] ( [[isloggedin]]( $@partymemberaid[.@i], $@partymembercid[.@i] ) )&lt;br /&gt;
 		[[set]] .@count_online, .@count_online +1 ;&lt;br /&gt;
 // We search [[AID|accountID]] &amp;amp; [[CID|charID]] because a single party can have multiple &lt;br /&gt;
 // characters from the same account. Without searching through the charID, &lt;br /&gt;
 // if a player has 2 characters from the same account inside the party but &lt;br /&gt;
 // only 1 char online, it would count their online char twice.&lt;br /&gt;
 &lt;br /&gt;
 [[if]] ( .@count_online != .register_num ) {&lt;br /&gt;
 	[[mes]] &amp;quot;All your party members must be online to continue&amp;quot;;&lt;br /&gt;
 	[[close]];&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 // copy the array to prevent players cheating the system&lt;br /&gt;
 [[copyarray]] .@partymembercid, $@partymembercid, .register_num;&lt;br /&gt;
 &lt;br /&gt;
 [[mes]] &amp;quot;Are you ready ?&amp;quot;;&lt;br /&gt;
 [[next]]; // careful here&lt;br /&gt;
 [[select]] &amp;quot;Yes&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 // When a script hits a [[next]], [[menu]], [[sleep]] or [[input]] that pauses the script, &lt;br /&gt;
 // players can invite or /leave and make changes in their party. To prevent &lt;br /&gt;
 // this, we call [[getpartymember]] again and compare with the original values.&lt;br /&gt;
 &lt;br /&gt;
 [[getpartymember]] [[getcharid]](1), 1;&lt;br /&gt;
 [[if]] ( $@partymembercount != .register_num ) {&lt;br /&gt;
 	[[mes]] &amp;quot;You've made changes to your party !&amp;quot;;&lt;br /&gt;
 	[[close]];&lt;br /&gt;
 }&lt;br /&gt;
 [[for]] ( [[set]] .@i, 0; .@i &amp;lt; $@partymembercount; [[set]] .@i, .@i +1 ) {&lt;br /&gt;
 	[[if]] ( .@partymembercid[.@i] != $@partymembercid[.@i] ) {&lt;br /&gt;
 		[[mes]] &amp;quot;You've made changes to your party !&amp;quot;;&lt;br /&gt;
 		[[close]];&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 // Finally, it's safe to start the event!&lt;br /&gt;
 [[warpparty]] &amp;quot;event_map&amp;quot;, 0,0, [[getcharid]](1);&lt;br /&gt;
&lt;br /&gt;
[[Category:Script Command]]&lt;/div&gt;</summary>
		<author><name>Via</name></author>	</entry>

	</feed>