Jump to content

Queue Script Command


pajodex

Recommended Posts


  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  429
  • Reputation:   163
  • Joined:  12/12/17
  • Last Seen:  

Hi,

So, I hope I would be hear out.. browsing thru Hercules forum, I found this particular topic.. What interest me the most is the Queue Iterator Script commands.

These are the commands from Hercules which can be used also here in rAthena. (Copied and pasted from that post)

Spoiler

 

Queue - 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 (0), HQO_OnLogout (1), HQO_OnMapChange (2) (the constant names are not final).
      
      queueopt(.@queue_id,0,"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:
    
    /* say create a queue */set .@id,queue();queueadd(.@id,getcharid(3));/* ... add as many entries ... (no limit) */i


 

My point is.. can this also be implemented in rAthena or something a-like? This would greatly help improve all scripts that will utilize queue system.. especially BGs.. This is just a suggestion.. Though it is possible to make a queue using arrays and stuff but it is more convenient when it has its own script command.

Thanks!

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

6 hours ago, pajodex said:

My point is.. can this also be implemented in rAthena or something a-like? This would greatly help improve all scripts that will utilize queue system.. especially BGs.. This is just a suggestion.. Though it is possible to make a queue using arrays and stuff but it is more convenient when it has its own script command.

uhh ... honestly ... rathena can survive without the queue iterator script commands ...
I've used it before, so its not a MUST HAVE stuffs

for example the last man standing script I've made for hercules -> http://herc.ws/board/topic/11185-last-man-standing-using-queue-iterator-script-commands/
is actually just a rewrite from this topic -> https://rathena.org/board/topic/90441-last-man-standing/

and for the battleground ... that's a misunderstanding
rathena *bg_create supports OnQuit and OnDeath event label
but hercules *bg_create_team doesn't ...
so its practically forcing the Hercules members to use Queue Iterator script commands to make battleground queue system
for example I made exact same system but meant for different emulator (herc/rA)
http://herc.ws/board/topic/15913-annieruru-emp-bg/
yeah, practically 2 different script ...
if you read the Hercules version carefully, you'll noticed that Hercules one,
after doing *bg_create_team and*bg_team_join, still has to add *queue and *queueadd, which is actually wasting memory in a sense


well, but its truly convenient in some cases
for example the *queueopt script command although only support 3 flags, but can extend more by plugin
can add more like QUEUEOPT_NOCHANGEEQ for example to make the players in the queue cannot change equipment ... etc

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  429
  • Reputation:   163
  • Joined:  12/12/17
  • Last Seen:  

3 hours ago, AnnieRuru said:

uhh ... honestly ... rathena can survive without the queue iterator script commands …

Yup.. True.. But it would still be cool if rA also implements this system.
As this system, if I am not mistaken, can reduce the usage of loop script commands for checking players, can be accessed by other npcs, and etc..
And it would be easier for other scripters to understand how the script will work..

 

3 hours ago, AnnieRuru said:

I've used it before, so its not a MUST HAVE stuffs

And this would also make sense.. But still the convenience it would contribute would be a great help.

 

Well, this is just my selfish suggestion.. It is not really something important at all.. ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...