Thread Tools Display Modes
08-08-13, 10:16 PM   #21
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
So far, it seems to work ok, exept, it's very confusing:

With testMode set to true and ManageGuild() not set to anything, it does the actions for real.
With testMode set to false and ManageGuild() not set to anything, it does the action for real.
With testMode set to false and ManageGuild(true), it runs in testMode, printing what should be done.

In fact the
Code:
		-- Pass "true" to do it for real, eg. self:ManageGuild(true)
		self:ManageGuild(true)
added to the testMode is kinda confusing. I don't understand why both.

Couldn't ManageGuild() be set to true 100% of the time since there's the testMode in place ?

Also, right now, it keeps running when the guild frame is shown, meaning i can't click on any of the tabs since the addon is running.

Lastly, how do you increase or decrease the time between each actions (if possible), it doesn't seems to be the SetDuration(), it's really not necessary, just curious.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 08-09-13 at 12:02 AM.
  Reply With Quote
08-09-13, 12:32 AM   #22
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
http://pastebin.com/RXczRYe6

Fixed. I switched it from "pass true for a test run" to "pass true for the real thing" but forgot to switch all the parts.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-09-13, 12:36 AM   #23
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Caellian View Post
Also, right now, it keeps running when the guild frame is shown, meaning i can't click on any of the tabs since the addon is running.
I don't think there was anything in the previous versions to stop the timer when you opened the guild frame, but I guess that wouldn't be too hard to add. I'll post another revision shortly.

Edit:
http://pastebin.com/SizQViXv

Originally Posted by Caellian View Post
Lastly, how do you increase or decrease the time between each actions (if possible), it doesn't seems to be the SetDuration(), it's really not necessary, just curious.
animation:SetDuration(seconds) so yes, it is the SetDuration line. What did you try changing it to? The value is specified in seconds, so if you changed it from 1 to 1.1, for example, it's unlikely you'd be able to really see the difference unless you add a timestamped print inside the OnFinished script.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 08-09-13 at 12:48 AM.
  Reply With Quote
08-09-13, 03:27 AM   #24
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
But, i still don't understand why there's now both the testMode true or false and ManageGuild(true) or not.

And i'm guessing finally: something weird happened today, i invited someone, he joined, and a second later this message came:"Action failed: PROMOTE PlayerX 7".

This wasn't consistent though, because for the next guy, nothing got printed.
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote
08-09-13, 04:28 AM   #25
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Caellian View Post
But, i still don't understand why there's now both the testMode true or false and ManageGuild(true) or not.
There's not. You no longer do anything with the testMode flag yourself. You just call ManageGuild -- if you pass an argument that evaluates to true then it will actually promote/kick people, otherwise it will just tell you what it would do (test mode).

If you're asking why the testMode variable still exists, it's because you need to remember whether you're in test mode from one animation run to the next, which means you need a variable outside of the animation's OnFinished script. But it's strictly an internal flag -- as an API you just call ManageGuild with the appropriate argument (or not) and don't need to even know the variable exists.

Originally Posted by Caellian View Post
And i'm guessing finally: something weird happened today, i invited someone, he joined, and a second later this message came:"Action failed: PROMOTE PlayerX 7".
Sounds like it's working as intended -- if an action fails for whatever reason (eg. if the server ignored your request to promote someone at the same time you invited someone) you don't want to just keep trying the same action over and over forever, so the loop will stop itself until the next GUILD_ROSTER_UPDATE triggers another pass.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-09-13, 04:41 AM   #26
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Originally Posted by Phanx View Post
Sounds like it's working as intended -- if an action fails for whatever reason (eg. if the server ignored your request to promote someone at the same time you invited someone) you don't want to just keep trying the same action over and over forever, so the loop will stop itself until the next GUILD_ROSTER_UPDATE triggers another pass.
Oh sorry i wasn't clear, the player joined, got promoted, and then i recieved the message saying the promotion failed
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 08-09-13 at 07:25 AM.
  Reply With Quote
08-09-13, 05:22 AM   #27
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Hmm. Well, that sounds like the guild roster API just hadn't updated for the promotion yet, and still returned the old rank, so the code tried to promote him again, which failed because he was actually already at the rank it tried to promote him to. The same thing happens if, for example, you try to call zone info APIs while crossing a zone boundary but before the appropriate event fires -- but since while the animation loop is running, you're not listening for GUILD_ROSTER_UPDATE events, you don't know when the event fires. That actually wasn't what I had in mind when I included the failure protection, but turns out to be a really good reason to have that protection in there.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-09-13, 05:36 AM   #28
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
I noticed something else:

There might be a problem with the function Management:GUILD_ROSTER_UPDATE()
When i'm logged in one of myChars, it works just fine, but, when i'm logged in with one of herChars, it doesn't do anything, and when i print(chars[name]) it prints a class which isn't the correct one.

For example, myChars online is a druid, herChars online is a warrior, printing chars[name] returns "MONK"


Edit1: it would seems that "if chars[name] then" is true even when myChars isn't online so i made some changes:


[code]
Code:
local name = GetGuildRosterInfo(i)
	if chars[name] then
is now:

Code:
local name, _, _, _, _, _, _, _, online = GetGuildRosterInfo(i)
	if chars[name] and online then

I also had to add another guild check at line 40.

Here's what i have now:

Lib
http://pastebin.com/GMD6AvMJ

Addon
http://pastebin.com/egYbxeez

Now it looks like it works as it should

Edit2: It's really kinda sad that the caelLib.myToons and caelLib.herToons tables have to be global, since this is the only addon that uses them directly, all the others only use caelLib.myChars and caelLib.herChars

Edit3: You wouldn't happen to know how to disable the sound it makes when a guild member/friend comes online by any chance, the social option only works for the message and not the sound, or friends. That or, it's location so that i could blank it, but well, it's not as good
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 08-09-13 at 12:43 PM.
  Reply With Quote
08-09-13, 03:49 PM   #29
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Caellian View Post
It's really kinda sad that the caelLib.myToons and caelLib.herToons tables have to be global, since this is the only addon that uses them directly, all the others only use caelLib.myChars and caelLib.herChars
In that case, they don't need to be global, just remove this from the lib file:
Code:
caelLib.myChars = caelLib.myToons[caelLib.playerRealm] and caelLib.myToons[caelLib.playerRealm][caelLib.playerName]
caelLib.herChars = caelLib.herToons[caelLib.playerRealm] and caelLib.herToons[caelLib.playerRealm][caelLib.playerName]
and replace this line in the addon file:
Code:
if not (caelLib.myChars or caelLib.herChars) then return end
with this:
Code:
local myChars = caelLib.myToons[caelLib.playerRealm] and caelLib.myToons[caelLib.playerRealm][caelLib.playerName]
local herChars = caelLib.herToons[caelLib.playerRealm] and caelLib.herToons[caelLib.playerRealm][caelLib.playerName]
if not (myChars or herChars) then return end
Originally Posted by Caellian View Post
You wouldn't happen to know how to disable the sound it makes when a guild member/friend comes online by any chance, the social option only works for the message and not the sound, or friends. That or, it's location so that i could blank it, but well, it's not as good
Sound\INTERFACE\FriendJoin.ogg

You'll have to override it with a silent sound file at the proper location, as the code that causes the sound to play is not part of the UI, so it can't be prevented by an addon.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-10-13, 04:36 AM   #30
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
No i meant, the other way around.

I do need myChars and herChars as globals because i use them in loads of addons.

I don't need the myToons and herToons tables as globals because i don't use them anywhere exept here in the management, you use it to check if the other manager is online.

Edit: Unless there's a better solution i made both tables local and then this in the lib:

Code:
caelLib.myToons = myToons[caelLib.playerRealm]
caelLib.myChars = myToons[caelLib.playerRealm] and myToons[caelLib.playerRealm][caelLib.playerName]
caelLib.herChars = herToons[caelLib.playerRealm] and herToons[caelLib.playerRealm][caelLib.playerName]
And then in the manager, i just changed:

Code:
local chars = caelLib.myToons[caelLib.playerRealm]
To

Code:
local chars = caelLib.myToons
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }

Last edited by Caellian : 08-10-13 at 06:46 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Guild Management addon help

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