WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Sync guild message with calendar (https://www.wowinterface.com/forums/showthread.php?t=43334)

Caetan0 04-25-12 09:42 AM

Sync guild message with calendar
 
Is there any project, addon ready or someone who is able to create (if not very difficult) an "addon" to change the guild message of the day according to the nearest event which is scheduled on the calendar?

example:
Today to 13:00 is scheduled on the calendar an event called RBG's Blue.

And so I log into the game, the addon finds that this is the event next event will happen and change the guild message of the day to:

"Attention, please visit the guild calendar and register for the event "%e" what will happen "%d" to "%t".

"%e" would be the event
"%d" would be the day
"%t" would be the time of the event

Soon the guild message of the day would be:
"Attention, please visit the guild calendar and register for the event "RBG's Blue" is going to happen "Today" to "13:00".

It would be possible to make an addon like that?

AcidWeb 04-25-12 10:59 AM

Quote:

Originally Posted by Caetan0 (Post 255833)
It would be possible to make an addon like that?

Yes. It is possible. Sadly I don't have currently active WoW subscription so I can't make it for you (I dont like drycoding :-) ).
So wait for someone else :-)

Xrystal 04-25-12 01:03 PM

Sounds feasible.

The next question however is whether it would be a guild master/level 2/based on motd changeability level restricted. So, if you weren't able to change the motd currently in essence you shouldn't be able to change it programmatically. I am sure that the addon functions for said changes would refuse to work anyway under those circumstances.

I'll take a look though. I'm guild master in a somewhat dead guild at present so can have plenty of fun testing that stuff out for ya.

Unless of course someone else has already started work on this ?

Caetan0 04-26-12 03:43 PM

Any news on this "project" friends?

Xrystal 04-26-12 04:07 PM

I had a dabble with it last night for a few hours but the OpenCalendar function doesn't always work. I'm trying to remember what I did before when I was playing with the calendar stuff but it was getting way too late last night to do anything more.

Tonight is my last night to dabble before my weekend break so I will see if I can at least have it consistently register something before I head to bed tonight. I hope .. already 11pm here so running low on time.

Caetan0 04-26-12 04:14 PM

thank you my friend, will be very helpful to me.

Xrystal 04-26-12 07:00 PM

Okay, 2am time for bed rofl ..

Here's an old thread ( 2 years old I believe ) that showed some form of calendar functionality that i got working with glitches that wasn't guild specific. I may have to take a look through that again in case the guild specific side is still not 100% but will have to see.

http://www.wowinterface.com/forums/s...9&postcount=21

However, I did get my current mini addon working the way as expected, but only once. I have no idea how it happened and how to get it to replicate it.

Caetan0 04-26-12 10:19 PM

then that means you can not create something similar to what I mentioned?

Excuse my lack of knowledge, but I do not know anything about programming. :)

Xrystal 04-27-12 01:13 AM

So far I have been unsuccessful in getting it to always appear with something that is on the calendar. It could be that there simply is not enough information for addons to access the calendar successfully or simple that it will take more than a few hours to get working. Sometimes the simplest task can be the most complicated to achieve.

Maybe someone else will be able to spot something I overlooked but seeing as I am hitting a similar brick wall as I did 2 years ago makes me wonder if it simply isn't possible to get to that information via an addon.

Phanx 04-27-12 09:41 PM

The in-game calendar is just an addon. If it can access information, then an addon can access the same information. If nobody has figured this out by the weekend I'll look into it, time permitting.

Xrystal 04-28-12 12:54 AM

Thanks Phanx,


It annoyed the hell out of me the last time I tried to get information out. It works fine if you manually click the calendar event open but if you use the OpenCalendar and OpenEvent functions it doesn't seem to be consistent.

This information on wowprogramming is what worries me of whether it is possible to automatically consistently open and read event information.

Quote:

Queries the server for calendar status information. May cause one or more CALENDAR_UPDATE_* events to fire depending on the contents of the player's calendar. In the default UI, called when the calendar is shown.

See also Calendar functions.
Signature:


OpenCalendar()


This function must query the remote server, and any results will not be immediately available to the game client. Please see the function's documentation for more information about how to retrieve any results.
And this is what wowpedia.org writes up about it.

Quote:

Requests calendar information from the server. Does not open the calendar frame.
OpenCalendar()

Triggers events
CALENDAR_UPDATE_EVENT_LIST, when your query has finished processing on the server and new calendar information is available.

Details
If called during the loading process, (even at PLAYER_ENTERING_WORLD) the query will not return.
I concentrated on the guild specific side of the calendar in the hopes it would be more specific but I am wondering if it will have to simply be the case of reading all events and testing for guild ones. That was going to be my next work on it when I get back home.

The following is the code I was using for my tests. The CALENDAR_UPDATE_GUILD_EVENTS event triggers occasionally when you first log in but seemingly never on reload. It always recognised how many events there were but would never get any information from them.

Lua Code:
  1. -- Get the localised addon information
  2. local addonName,addonData = ...
  3.  
  4. addonData.CanEditMotD = function() return CanEditMOTD() end
  5. addonData.CurrentMOTD = function() return GetGuildRosterMOTD() end
  6. addonData.SetMOTD = function(msg) GuildSetMOTD(msg) end
  7. addonData.GetNumEvents = function() return CalendarGetNumGuildEvents() end
  8. addonData.GetEventInfo = function()
  9.     local   title, description, creator, eventType, repeatOption, maxSize,
  10.             textureIndex, weekday, month, day, year, hour, minute,
  11.             lockoutWeekday, lockoutMonth, lockoutDay, lockoutYear, lockoutHour,
  12.             lockoutMinute, locked, autoApprove, pendingInvite, inviteStatus,
  13.             inviteType, calendarType = CalendarGetEventInfo()
  14.     return title,eventType,hour,minute,pendinginvite,inviteStatus,inviteType
  15. end
  16. addonData.OpenEvent = function(mOffset,day,index) CalendarOpenEvent(mOffset,day,index) end
  17. addonData.OpenCalendar = function() OpenCalendar() end
  18. addonData.CloseEvent = function() CalendarCloseEvent() end
  19. addonData.SetMonth = function(month,year) CalendarSetAbsMonth(month,year) end
  20. addonData.GetEventTypes = function() return CalendarEventGetTypes() end
  21. addonData.IsInvited = function() return CalendarEventHasPendingInvite() end
  22. addonData.GetDate = function()
  23.     local weekday,month,day,year = CalendarGetDate()
  24.     return day,month,year
  25. end
  26.  
  27. local function OnEvent(self,event,arg1,arg2,arg3,arg4,arg5)
  28.     if ( event == "ADDON_LOADED" and arg1 == addonName ) then
  29.         if not IsAddOnLoaded("Blizzard_Calendar") then
  30.             LoadAddOn("Blizzard_Calendar")
  31.         end
  32.     elseif ( event == "VARIABLES_LOADED" ) then
  33.         print(event,arg1,arg2,arg3,arg4,arg5)
  34.     elseif ( event == "PLAYER_ENTERING_WORLD" ) then
  35.         print(event,arg1,arg2,arg3,arg4,arg5)
  36.         addonData.OpenCalendar()
  37.         addonData.CurDate = {}
  38.         addonData.CurDate.Day,addonData.CurDate.Month,addonData.CurDate.Year = addonData.GetDate()
  39.         addonData.SetMonth( addonData.CurDate.Month, addonData.CurDate.Year )
  40.     elseif ( event == "CALENDAR_UPDATE_GUILD_EVENTS" ) then
  41.         print(event,arg1,arg2,arg3,arg4,arg5)
  42.         addonData.NumGuildEvents = addonData.GetNumEvents()
  43.         print(addonData.NumGuildEvents)
  44.         if ( addonData.NumGuildEvents == 0 ) then return end
  45.         addonData.EventTypes = addonData.GetEventTypes()
  46.         addonData.MotD = ""
  47.         addonData.DaysToCheck = 7      
  48.         local title,type,hour,min,pending,status
  49.         for eventID = 1,addonData.NumGuildEvents do
  50.             addonData.eventID = eventID
  51.             print("Opening event ", eventID, " of ", addonData.NumGuildEvents)
  52.             addonData.OpenEvent(0,28,eventID)
  53.             title,type,hour,min,pending,status = addonData.GetEventInfo()
  54.             print(title,type,hour,min,pending,status)  
  55.         end
  56.         print(addonData.MotD)
  57.     elseif ( event == "CALENDAR_UPDATE_EVENT" ) then
  58.         print(event,arg1,arg2,arg3,arg4,arg5)
  59.         local title,type,hour,min,pending,status = addonData.GetEventInfo()
  60.         print(title,type,hour,min,pending,status)  
  61.     elseif ( event == "CALENDAR_OPEN_EVENT" ) then
  62.         print(event,arg1,arg2,arg3,arg4,arg5)
  63.         local title,type,hour,min,pending,status = addonData.GetEventInfo()
  64.         addonData.Event = addonData.Event or {}
  65.         addonData.Event[addonData.eventID] = {}
  66.         addonData.Event[addonData.eventID].Title = title
  67.         addonData.Event[addonData.eventID].Type = type
  68.         addonData.Event[addonData.eventID].Hour = hour
  69.         addonData.Event[addonData.eventID].Minute = min
  70.         addonData.Event[addonData.eventID].Pending = pending
  71.         addonData.Event[addonData.eventID].Status = status
  72.         addonData.MotD = addonData.MotD .. "\n" .. title .. " at " .. hour .. ":" .. min
  73.     elseif ( event == "GUILD_MOTD" ) then
  74.         print(event,arg1,arg2,arg3,arg4,arg5)
  75.     elseif ( event == "PLAYER_GUILD_UPDATE" ) then
  76.         print(event,arg1,arg2,arg3,arg4,arg5)
  77.     elseif ( event == "COMBAT_LOG_EVENT_UNFILTERED" or event == "WORLD_MAP_UPDATE" or event == "UPDATE_MOUSEOVER_UNIT") then
  78.         self:UnregisterEvent(event)
  79.     elseif ( event == "CHAT_MSG_CHANNEL" or event == "UPDATE_INVENTORY_DURABILITY") then
  80.         self:UnregisterEvent(event)
  81.     else
  82.         print(event,arg1,arg2,arg3,arg4,arg5)
  83.     end
  84. end
  85.  
  86. local XGMotDFrame = CreateFrame("Frame","XGMotDFrame",UIParent)
  87. XGMotDFrame:SetScript("OnEvent", OnEvent)
  88. XGMotDFrame:RegisterEvent("ADDON_LOADED")
  89. XGMotDFrame:RegisterEvent("VARIABLES_LOADED")
  90. XGMotDFrame:RegisterEvent("CALENDAR_UPDATE_GUILD_EVENTS")
  91. XGMotDFrame:RegisterEvent("CALENDAR_OPEN_EVENT")
  92. XGMotDFrame:RegisterEvent("GUILD_MOTD")
  93. XGMotDFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
  94. XGMotDFrame:RegisterEvent("PLAYER_GUILD_UPDATE")
  95. XGMotDFrame:RegisterEvent("CALENDAR_UPDATE_EVENT")

Caetan0 05-01-12 10:33 PM

Friend, I used this code but its not had much success in changing the guild message of the day.

Xrystal 05-02-12 12:51 AM

Yeah thats the problem. It should work but it doesn't as the events don't trigger. It's not set to change the message yet but should print a message at the point it would change the motd text. I've not got much time this week to dabble with it but I will try my other theory when I get home tonight if I'm not too late.

Xrystal 05-02-12 07:14 PM

Okay, found a function in the wow files that I didn't see in wowprogramming and must have missed from wowpedia, and it all seems to work apart from your main requirement ... updating the MotD text automatically. Here's the code anyway. Hopefully Phanx can see what is wrong.

Lua Code:
  1. -- Get the localised addon information
  2. local addonName,addonData = ...
  3. addonData.MotD = ""
  4.  
  5. addonData.CheckGuildEvents = function()
  6.     addonData.NumGuildEvents = CalendarGetNumGuildEvents()
  7.     if ( addonData.NumGuildEvents == 0 ) then return end
  8.     local month, day, weekday, hour, minute, eventType, title, calendarType, textureName
  9.     for i = 1,addonData.NumGuildEvents do
  10.         month, day, weekday, hour, minute, eventType, title, calendarType, textureName = CalendarGetGuildEventInfo(i);
  11.         thisInfo = tostring(i) .. ": " .. title .. " at " .. GameTime_GetFormattedTime(hour, minute, true) .. " on " .. string.format(GUILD_NEWS_DATE, CALENDAR_WEEKDAY_NAMES[weekday], day, month)
  12.         -- GuildSetMOTD(thisInfo)               -- This works
  13.         if ( strlen(addonData.MotD) + strlen(thisInfo) > 128 ) then
  14.             -- GuildSetMOTD(addonData.MotD)     -- This doesn't work, wipes out old MotD but this doesn't appear in its place
  15.             break
  16.         else
  17.             addonData.MotD = string.format("%s\n%s",addonData.MotD, thisInfo)
  18.             -- GuildSetMOTD(addonData.MotD)     -- This doesn't work, wipes out old MotD but this doesn't appear in its place
  19.         end
  20.     end
  21.    
  22.     print(addonData.MotD, "(", strlen(addonData.MotD), ")")
  23.     GuildSetMOTD(addonData.MotD)                -- This doesn't work, wipes out old MotD but this doesn't appear in its place
  24.     --GuildSetMOTD("Testing testing 1 2 3")     -- This works
  25. end
  26.  
  27. local function OnEvent(self,event,arg1,arg2,arg3,arg4,arg5)
  28.     if ( event == "ADDON_LOADED" and arg1 == addonName ) then
  29.         if not IsAddOnLoaded("Blizzard_Calendar") then
  30.             LoadAddOn("Blizzard_Calendar")
  31.         end
  32.     elseif ( event == "PLAYER_ENTERING_WORLD" ) then
  33.         local weekday,month,day,year = CalendarGetDate()
  34.         local month, year, numDays, firstWeekday = CalendarGetMonth(0)
  35.         CalendarSetAbsMonth(month,year)    
  36.         OpenCalendar()
  37.     elseif ( event == "CALENDAR_UPDATE_GUILD_EVENTS" ) then
  38.         addonData.CheckGuildEvents()
  39.     elseif ( event == "CALENDAR_UPDATE_EVENT_LIST" ) then
  40.         addonData.CheckGuildEvents()
  41.     end
  42. end
  43.  
  44. local XGMotDFrame = CreateFrame("Frame","XGMotDFrame",UIParent)
  45. XGMotDFrame:SetScript("OnEvent", OnEvent)
  46. XGMotDFrame:RegisterEvent("ADDON_LOADED")
  47. XGMotDFrame:RegisterEvent("CALENDAR_UPDATE_GUILD_EVENTS")
  48. XGMotDFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
  49. XGMotDFrame:RegisterEvent("PLAYER_GUILD_UPDATE")
  50. XGMotDFrame:RegisterEvent("CALENDAR_UPDATE_EVENT_LIST")

CALENDAR_UPDATE_EVENT_LIST is triggered everytime you reload the UI and CALENDAR_UPDATE_GUILD_EVENTS is triggered when you first log in and when new guild events are added.

p3lim 05-02-12 08:30 PM

Quote:

Originally Posted by Xrystal (Post 256076)
Okay, found a function in the wow files that I didn't see in wowprogramming and must have missed from wowpedia...

Which function might that be?

Xrystal 05-03-12 01:33 AM

Quote:

Originally Posted by p3lim (Post 256077)
Which function might that be?

The one that gets the GuildEventInfo. When I was going through and listing all the calendar functions at the start of the project I was only looking through wowprogramming and totally forgot about seeing if wowpedia had anything different *slaps head*


But, I also forgot to use the Event List event as I was expecting to need a guild specific one to get just guild details but apparently not. This was what was stopping it from working all the time. *slaps head again*

I'll use the excuse I was doing this after 12 hr work days and very little sleep .. rofl.

Caetan0 05-03-12 06:26 PM

My friend, now seems to be working perfectly, so I enter the game or reload the screen, displays the list of events that week, and the guild message of the day is changed.

But I do not know if I'm using the wrong way, but the message of the guild is always changed and is no message. I change it?

p3lim 05-03-12 07:02 PM

Quote:

Originally Posted by Xrystal (Post 256082)
The one that gets the GuildEventInfo. When I was going through and listing all the calendar functions at the start of the project I was only looking through wowprogramming and totally forgot about seeing if wowpedia had anything different *slaps head*

It's been updated on wowprogramming.com

Xrystal 05-04-12 12:04 AM

Cool, thanks P3lim

Caetan0 05-07-12 04:09 PM

friend,

I used the codes you sent but do not know what is acontecento it does not work with me whenever I enter the game it changes the guild message of the day and leave it blank, is there anything I should change?


All times are GMT -6. The time now is 01:43 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI