hello then DoEmote ( "HELLO" ) end end - note we don't pass `self` here because of hooksecurefunc, hence the dot instead of colon function HelloWorld. JumpOrAscendStart ) self : InitializeOptions () self : UnregisterEvent ( event ) end end function HelloWorld : PLAYER_ENTERING_WORLD ( event, isLogin, isReload ) if isLogin and self. " times" ) local version, build, _, tocversion = GetBuildInfo () print ( format ( "The current WoW build is %s (%d) and TOC is %d", version, build, tocversion )) self : RegisterEvent ( "PLAYER_ENTERING_WORLD" ) hooksecurefunc ( "JumpOrAscendStart", self. sessions 1 print ( "You loaded this addon ". db = HelloWorldDB for k, v in pairs ( self. We can also add a shorter /reload command. Print(format("hello %s and also %s", name1, name2 or "Carol")) If #name1 > 0 then - check for empty string define the corresponding slash command handler Using a slash command - increment the index for each slash command Any SLASH_* globals will automatically be registered as a slash command. Slash commands are an easy way to let users interact with your addon. OnEvent ) Slash commands Main article: Creating a slash command FrameXML: RegisterNewSlashCommand() ) end function f : ADDON_LOADED ( event, addOnName ) print ( event, addOnName ) end function f : PLAYER_ENTERING_WORLD ( event, isLogin, isReload ) print ( event, isLogin, isReload ) end function f : CHAT_MSG_CHANNEL ( event, text, playerName, _, channelName ) print ( event, text, playerName, channelName ) end f : RegisterEvent ( "ADDON_LOADED" ) f : RegisterEvent ( "PLAYER_ENTERING_WORLD" ) f : RegisterEvent ( "CHAT_MSG_CHANNEL" ) f : SetScript ( "OnEvent", f. ![]() ![]() Local f = CreateFrame ( "Frame" ) function f : OnEvent ( event. To respond to events you create a frame with CreateFrame() and register the events to it.Įvent payload in the chat window and /etrace For example CHAT_MSG_CHANNEL fires when someone sends a message in a chat channel like General and Trade. Responding to events Main article: Handling eventsĪlmost every action in the game is an Event which tells the UI that something happened.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |