View Single Post
06-29-10, 09:21 AM   #11
Fodaro
A Cyclonian
 
Fodaro's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 42
OK, I've modified your function, v6o, to avoid using CalendarGetNumDayEvents, and it's working fine when I run it after I've opened the calendar or called OpenCalendar.

lua Code:
  1. function CheckNextSevenDays()
  2.     print("Welcome Screen Guild Page getting calendar information:")
  3.  
  4.     local day = select(3, CalendarGetDate())
  5.     local month = 0 -- calendar use offset by default so 0 is current, -1 previous, +1 is next
  6.     local numDays = select(3, CalendarGetMonth(month))
  7.     for d=1,7 do
  8.         if day > numDays then
  9.             month = month + 1
  10.             day = 1
  11.             numDays = select(3, CalendarGetMonth(month))
  12.         end
  13.         local safety = 100
  14.         local i = 1
  15.         while true do
  16.             local title, hour, minute, calendarType, sequenceType, eventType, texture, modStatus, inviteStatus,
  17.                 invitedBy, difficulty, inviteType, sequenceIndex, numSequenceDayss = CalendarGetDayEvent(month, day, i)
  18.             if title then
  19.                 if eventType ~= 0 then -- Ignore holidays, call to arms, fishing contests etc.
  20.                     print(inviteStatus.." : "..title.." (type "..eventType..")")
  21.                 end
  22.                 i = i + 1
  23.             else -- no more events
  24.                 break
  25.             end
  26.            
  27.             if safety == 0 then
  28.                 print("SAFETY!")
  29.                 break
  30.             else
  31.                 safety = safety - 1
  32.             end
  33.             day = day + 1
  34.         end
  35.     end
  36. end

I've worked out that CALENDAR_UPDATE_EVENT_LIST fires once its ready, but I'm not sure when to call OpenCalendar, as I want my frame to appear when the player logs in. I've tried PLAYER_ENTERING_WORLD and PLAYER_LOGIN.

Sorry, but I can't work out what your screenshots mean, Xrystal. The second one (with PLAYER_ENTERING_WORLD on relog) seems to be working, but when are you calling OpenCalendar?

Thanks for your help guys,
__________________
Fodaro
(Main: Fodaro-Bronzebeard (EU))
Author of CharNote and Consolid8
  Reply With Quote