Quantcast
WoWInterface - View Single Post - LUA CreateFrame, then RemoveFrame??
View Single Post
08-22-14, 09:50 AM   #9
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by RyinntheDK View Post
Now to enhance the experience of the user, how would i pass show/hide on just /rcf, like a toggle?
If the user adds no parameters to the slash command the Msg variable should be Nil. So, this should work:

[e] As I read Choonsters reply I'm actually unsure if the value will be Nil or an empty string. *shrug*


Lua Code:
  1. local function Ryinn_Command(Msg) --"Editbox" was unused
  2.     if Msg then Msg=strlower(Msg); end
  3.     if Msg == "help" then
  4.         print("v"..AddonVersion)
  5.         print("Use /rcf + on/off to Enable/Disable")
  6.         print("Example: /rcf on")
  7.     elseif Msg == "on" then
  8.         frame:Show() -- Choonster: Showing the frame makes it visible and allows its OnUpdate handler to fire.
  9.         print("Ryinn's Flash Cursor is Now Enabled. Use /ryn off to disable")
  10.     elseif Msg == "off" then
  11.         frame:Hide() -- Choonster: Hiding the frame makes it invisible and stops its OnUpdate handler from firing.
  12.         --StaticPopup_Show("ReloadPop")
  13.         print("test")
  14.     elseif not Msg
  15.         if frame:IsVisible() then
  16.                 frame:Hide()   
  17.         else
  18.                 frame:Show()
  19.         end
  20.     else
  21.         Ryinn_Command("help")  
  22.     end
  23. end

Last edited by Duugu : 08-22-14 at 09:53 AM.
  Reply With Quote