this is quite taking longer than I expected, to show some movement/give you guys another sneak peek:
the upcoming universal queue script commands that the new battleground scripts will be using (can be used for anything else as well, e.g. custom events)
10 new script commands
- queue()
- creates a new queue instance, returns created queue id
set .@id,queue();
[*]queuesize(<queue_id>
- returns the amount of entries in queue instance of <queue_id>.
set .@length,queuesize(.@queue_id);
[*]queueadd(<queue_id>,<var_id>
- adds <var_id> to queue of <queue_id>, returns 1 if <var_id> is already present in the queue, 0 otherwise.
queueadd(.@queue_id,.@var_id);
[*]queueremove(<queue_id>,<var_id>
- removes <var_id> from queue of <queue_id>, returns 1 if <var_id> is not present in the queue, 0 otherwise.
queueremove(.@queue_id,.@var_id);
[*]queueopt(<queue_id>,<optionType>,{Optional <option val>})
- modifies <queue_id>'s <optionType>, when <option val> is not present, <optionType> is removed from <queue_id>, when present it modifies <queue_id>'s <optionType> with the new <option val> value.
Currently 3 options are available, HQO_OnDeath, HQO_OnLogout, HQO_OnMapChange (the constant names are not final).
queueopt(.@queue_id,HQO_OnDeath,"MyNPC::MyOnQueueMemberDeathEventName");It allows you to hook npc events to be triggered by specific actions that may happen to a player in the queue (when the queue in question is used for account ids)
[*]queuedel(<queue_id>
- deletes <queue_id> returns 1 when <queue_id> is not found, 0 otherwise.
queuedel(.@queue_id);
[*]queueiterator(<queue_id>
- creates a new queue iterator instance, a queue iterator is not a reference to a queue's actual members, it copies the queues members when initialized, this way you can loop through them even if you remove them from the queue
set .@it,queueiterator(.@queue_id);
[*]qicheck(<queue_iterator_id>
- checks whether there is a next member in the iterator's queue, 1 when it does, 0 otherwise.
qicheck(.@queue_iterator_id);
[*]qiget(<queue_iterator_id>
- obtains the next member in the iterator's queue, returns the next member's id or 0 when it doesnt exist.
for( set .@elem,qiget(.@queue_iterator_id); qicheck(.@queue_iterator_id); set .@elem,qiget(.@queue_iterator_id) )
[*]qiclear(<queue_iterator_id>
- deletes a queue iterator from memory, returns 1 when it fails, 0 otherwise.
qiclear(.@queue_iterator_id)
Sample Usage:
Code:
/* say create a queue */set .@id,queue();queueadd(.@id,getcharid(3));/* ... add as many entries ... (no limit) */if( queuesize(.@id) == 999 ) { /* whatever */}/* anywhere in the code */set .@it,queueiterator(.@id);for( set .@elem,qiget(.@it); qicheck(.@it); set .@elem,qiget(.@it) ) { //do anything e.g. /* attachrid .@elem; */ /* mes "ID:"+.@elem; */}qiclear(.@it);