Thread Tools Display Modes
05-28-11, 06:17 PM   #21
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Originally Posted by Myke916 View Post
1) The Queue (just like waiting in line... by definition) is used to Select The master, who ever has lead and remains online, stays at the top of the queue, when logged off, next person in line takes master.. its just a way of forming a line so they dont have to randomly decide or choose by roll... thus, there is not master and client model... its all wrapped into 1 code... it is decided by number of users running the addon itself...
Hm, the idea of a queue, correct me if I'm wrong, is to handle objects in a respective order.

But you're describing, that you want to include certain priorities into it, so, why messing with a complicate data structure?

If you're going to have priorities in your addon, why should you care, who of 5 online officers is the master? It should be sufficient to identify one master, all the other guys are slaves/clients.

You could register to some guild-member-events, to get to know that somebody signs on/off and then determine the master.

If there is more than one person of the group in question, choose the master randomly.

lua Code:
  1. local function FindMaster(master)
  2.  
  3.     -- if master is still online, do nothing
  4.  
  5.     -- else:
  6.     -- find group with highest rank
  7.     -- get their (online) members
  8.     -- choose one
  9.  
  10.     -- return
  11. end
  12.  
  13. local currentMaster = nil
  14. local frame = CreateFrame('Frame')
  15. frame:RegisterEvent('GUILD_ROSTER_UPDATE')
  16. frame:SetScript('OnEvent', function()
  17.     currentMaster = FindMaster(currentMaster)
  18.     PublishNewMaster(currentMaster)
  19. end)
__________________
  Reply With Quote
05-28-11, 06:18 PM   #22
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Myke916 View Post
can u send tables over the addonchannel
Yes, but you have to turn it into a string somehow first, and then the receiver has to turn it back into a table. Probably the easiest method would be to use the AceSerializer-3.0 library, which will handle both serialization (turning the table into a string) and deserialization (turning the string back into a table).

If you're sending huge amounts of data, you may also want to look at LibCompress-1.0, which provides data compression, and/or AceComm-3.0, which will handle breaking up large messages into multiple messages, sending them to other people, and recombining the chunks on the other end.

Something like this:

1. Use AceSerializer-3.0 to turn your table into a string.
2. Use LibCompress-1.0 to compress the string.
3. Use AceComm-3.0 to break up and send the compressed string as multiple addon comm messages.

Then, the person receiving your comms would do this:

1. Use AceComm-3.0 to reassemble the comm messages into the complete, compressed string.
2. Use LibCompress-1.0 to decompress the string.
3. Use AceSerializer-3.0 to turn the string back into the original table.
  Reply With Quote
05-28-11, 08:25 PM   #23
Myke916
A Deviate Faerie Dragon
 
Myke916's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 18
Originally Posted by Mischback View Post
Hm, the idea of a queue, correct me if I'm wrong, is to handle objects in a respective order.

local currentMaster = nil
local frame = CreateFrame('Frame')
frame:RegisterEvent('GUILD_ROSTER_UPDATE')
frame:SetScript('OnEvent', function()
currentMaster = FindMaster(currentMaster)
PublishNewMaster(currentMaster)
end)
[/highlight]
true, problem with that is i have over 1000 members in my guild... cant do random... but i do understand where your going... seems nifty... but.. id focus more on chat trigger rather than online/offline trigger, considering the fact that my addon is a chatmod... but for other types of addons... sure..
__________________
author of:
-=GuildBot=-
  Reply With Quote
06-01-11, 10:36 PM   #24
Myke916
A Deviate Faerie Dragon
 
Myke916's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 18
getting closer

i did it on paper.... to many variables to do in my head and on screen...

i also went to a noisy resturaunt.. it helped drown out the noise of my thinking, and made me get into a mind frame to build it...

im working on it, got it about 50% done tonight... will finish up these next few days, ill post the code snippet when done...

its gonna be kinda big, allready over 100 lines..

EDIT: over 200 lines now, still not done!!!
__________________
author of:
-=GuildBot=-

Last edited by Myke916 : 06-02-11 at 06:06 PM.
  Reply With Quote
06-04-11, 01:40 PM   #25
Myke916
A Deviate Faerie Dragon
 
Myke916's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 18
had to startover 2 more times, but...

upto 300 lines!!!

i managed to save the code every milestone, and messed up a few times, but had code to fall back on....

might have accidentially finished the code today, but! it needs to be tested for a few weeks before i release the snippet or update my addon to a release..

but it seems to work... day 14... and im tired of this code...

but it seems built and should run!! just needs some fine tuning and cleaning up the code a bit...

had a few problems... maybe someone can tell me how to do this:

When logging on, its supposed to "SendAddonMessage(1,2,3,4)" but it doesnt.. only when ReloadUI(),
alternative method i used: i created a frame, and built a loop timer inside, so 1 minute after login it sends the login "HELLO?!?!" message.... by giving that delay, it listens to the addonchannel.. if it recieves queue data, it takes its place in the queue.. or if no data is recived in that time, it sends out a "HELLO?!?!" and if the leader replys, it recieves the leaders data

eventually if no leader replys it assumes lead position.

This is a monster code, and it wasnt easy.... two weeks... im tired of the damn word QUEUE, i must have said it, and thought it... and typed it at least a couple thousand times...

almost done... im testing now... will post the final info soon!!!
__________________
author of:
-=GuildBot=-

Last edited by Myke916 : 06-04-11 at 01:43 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Need Help Building a Queue

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off