Thread Tools Display Modes
06-15-10, 09:40 AM   #1
Fodaro
A Cyclonian
 
Fodaro's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 42
Getting a list of pending events

Hello everyone,

I'm starting to work on a mod with a friend. The plan is to have a 'Welcome screen' appear when you log into the game, reminding you of what you were doing, transmutes you want to do, guild stuff, etc. The plan is to have two panes which will show different information. The user will be able to choose which two panes they want to see on login.

That's all well and good, but on the Guild Information pane I want to show a list of guild events that the player has been invited to, but not yet responded to. I believe CalendarGetNumPendingInvites gives the number of them, and CalendarGetFirstPendingInvite gives the first one, but after that I can't find out how to get the rest.

I suppose I could loop through all the events in the calendar and check each one, or just have a button to say "X invites pending..." but there must be a better way, mustn't there?

Thanks,
__________________
Fodaro
(Main: Fodaro-Bronzebeard (EU))
Author of CharNote and Consolid8
  Reply With Quote
06-15-10, 10:21 AM   #2
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
but after that I can't find out how to get the rest.
I suppose I could loop through all the events in the calendar and check each one
Hope you don't mind me quoting yourself; but you answered your own question.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
06-15-10, 11:06 AM   #3
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Maybe an example would be more helpful.

Personally I'd probably not use the 2nd function you mentioned (CalendarGetFirstPendingInvite) as it only returns the event index of the current day you're checking and I'm guessing it just does the same check you'll be doing anyway.
You could also get rid of CalendarGetNumDayEvents and just check if the event title is nil (no more events)

You won't need to "open" the events unless you want to check another player's status. So it's enough calling CalendarGetDayEvent()

Code:
-- Events for the next 7 days
CheckNextSevenDays = function()
    local day = select(3, CalendarGetDate())
    local month = 0 -- calendar use offset by default so 0 is current, -1 previous, +1 is next
    for d=1,7 do
        if day > 31 then -- I don't know the function name to retrieve how many days there is a month
            month=month + 1
            day = 1
        end
        local num = CalendarGetNumDayEvents(month, day)
        for e=1,num do
            local title, hour, minute, calendarType, sequenceType, eventType, texture, modStatus, inviteStatus, invitedBy, difficulty, inviteType, sequenceIndex, numSequenceDayss = CalendarGetDayEvent(month, day, e)
            --[[
            CALENDAR_INVITESTATUS_INVITED      = 1
            CALENDAR_INVITESTATUS_ACCEPTED     = 2
            CALENDAR_INVITESTATUS_DECLINED     = 3
            CALENDAR_INVITESTATUS_CONFIRMED    = 4
            CALENDAR_INVITESTATUS_OUT          = 5
            CALENDAR_INVITESTATUS_STANDBY      = 6
            CALENDAR_INVITESTATUS_SIGNEDUP     = 7
            CALENDAR_INVITESTATUS_NOT_SIGNEDUP = 8
            CALENDAR_INVITESTATUS_TENTATIVE    = 9
            --]]
            print(inviteStatus .." : ".. title)
            -- This printed 1: Midsummer Fire Festival as well so remember to check the types
        end
        day = day + 1
    end
end
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
06-16-10, 09:57 AM   #4
Fodaro
A Cyclonian
 
Fodaro's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 42
OK, thanks v6o, I'll try that.
__________________
Fodaro
(Main: Fodaro-Bronzebeard (EU))
Author of CharNote and Consolid8
  Reply With Quote
06-17-10, 01:56 PM   #5
Fodaro
A Cyclonian
 
Fodaro's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 42
Strange... the script doesn't print anything. After a bit of messing around, it appears that CalendarGetNumDayEvents is returning 0, or sometimes 1 or 2. Either way, there doesn't appear to be any relation to the number of events on that day. Maybe I'll just show a count of pending invites.
__________________
Fodaro
(Main: Fodaro-Bronzebeard (EU))
Author of CharNote and Consolid8
  Reply With Quote
06-17-10, 02:21 PM   #6
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Are you running this script before calendar is filled with events?

Are you testing my script as I posted it or did you edit something?

Are you completely sure the month and day is correct with offsets as I explained in a comment in the script?

If it still doesn't work why don't you just drop the function and do as I said you could in my previous post (same post as the script)
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 06-17-10 at 02:34 PM. Reason: changed `date´ to `day´
  Reply With Quote
06-17-10, 02:30 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 6,006
I played with the calendar a few weeks back to check something for someone. Let me see what I ended up doing and if it ended up working rofl. I think there is a certain function/event that has to be used or triggered before you can get event information from the calendar.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 70 - Resto Druid
Gamaliel - 70 - Disc Priest
Lienae - 70 - Resto Shaman
Velandryn - 70 - Prot Paladin (TR)
+ 5 at 60+
+ 2 at 40+

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Getting a list of pending events


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