WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Auto open calendar on login (https://www.wowinterface.com/forums/showthread.php?t=58710)

Yukka 04-27-21 07:11 PM

Auto open calendar on login
 
Hi I sometimes forget to open the calendar to watch if there's events today or next days, I cant make addons because I have no knowledge, can someone nice share the code or create an addon that auto open the calendar when login with a character? Thanks a lot.

LudiusMaximus 04-28-21 12:59 PM

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:SetScript("OnEvent", ToggleCalendar)
  3. f:RegisterEvent("PLAYER_ENTERING_WORLD")

SDPhantom 04-28-21 04:40 PM

That'll open the calendar every time you load in a new area too. I'd suggest using PLAYER_LOGIN instead.
If you need help converting code into an addon, there's a handy tool to do that. Just give it a name for the title and paste the code in the area below.

LudiusMaximus 04-28-21 04:45 PM

Quote:

Originally Posted by SDPhantom (Post 338982)
That'll open the calendar every time you load in a new area too.

Good point! :-) Make it this then:

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:SetScript("OnEvent", function(_, _, isLogin, isReload)
  3.   if isLogin or isReload then ToggleCalendar() end
  4. end)
  5. f:RegisterEvent("PLAYER_ENTERING_WORLD")

Quote:

Originally Posted by SDPhantom (Post 338982)
I'd suggest using PLAYER_LOGIN instead.

Also good, if you don't care about the reload.

SDPhantom 04-28-21 05:02 PM

Quote:

Originally Posted by LudiusMaximus (Post 338983)
Also good, if you don't care about the reload.

Last I checked, it still works on reload. You just can't differentiate it between a login or reload.

LudiusMaximus 04-28-21 05:04 PM

Quote:

Originally Posted by SDPhantom (Post 338984)
Last I checked, it still works on reload. You just can't differentiate it between a login or reload.

Ah, even better! Then definitely go for this:

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:SetScript("OnEvent", ToggleCalendar)
  3. f:RegisterEvent("PLAYER_LOGIN")

Yukka 04-30-21 04:45 AM

AMAZING :D Thanks a lot guys! I'll never miss an event anymore.

Wish you good health


All times are GMT -6. The time now is 07:56 PM.

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