Slash Commands
I've read so many posts and tutorials on this but I can't find the fault in my code... i have
Code:
SlashCmdList["RAIDLOCKREPORT"] = DEFAULT_CHAT_FRAME:AddMessage("Working"); |
Quote:
Code:
SlashCmdList["RAIDLOCKREPORT"] = function() Edit: Assuming the addon where you have that code is actually loading without errors. |
Thanks that worked! So am I to understand that SlashCmdList[""] need to be a function then?
|
A function with a single string parameter if needed.
It could be: Code:
SlashCmdList["RAIDLOCKREPORT"] = function(msg) |
Gotcha, so, the slash command is working, but the goal of the slash command is to show the frame again after its been closed. Once again, everywhere I check, I need to use the Show() function for the frame. When I run this code, the "Working" message still shows so i know that the slash is working, but the frame doesn't show and when I hit enter to send the command the text stays in the bar.
Also, aside from the book, where can i find these answers so i don't have to ask so often? Google is failing me only giving me poorly descriptive API pages... Code:
SlashCmdList["RAIDLOCKREPORT"] = function() |
wowprogramming.com and wowpedia.org are two good sites.
You should be getting an error which is why you're seeing this behaviour so, you need to turn on "Display lua Errors" in the Interface\Help options or better yet get BugGrabber and BugSack Anything local needs to be declared before it is called so in this case to create a toggle, Code:
local UIConfig = CreateFrame("Frame", "MUI_BuffFrame", UIParent, "BasicFrameTemplateWithInset"); |
So its the location where I put the slash command that's messing it up?, I do have the frame described further in the code. I read somewhere that the slash commands needed to be declared in the beginning of the code
|
It's technically the location of the local declaration but symantics :).
The slash command can be anywhere, I tend to place them at the bottom of my main code page. Pretty much all of the API documentation is user generated and times and the API change but the documentation doesn't always get updated along with the changes which makes WoWInterface an extremely useful site. |
this is the simplest way i found
simplest way i found
Code:
SLASH_COMMAND1 = "/text" |
The compiler reads your code like a book, from start to finish. If you don't declare variables before you use them, they'll always be nil (unless they exist in a higher scope). As an example:
Lua Code:
Lua Code:
|
ok this is something i used for my config base frame now your main frame to hide all would be in the place of config_BaseFrame
also note i nested this to my topFrame and the toggle for it was a button, when i clicked the button it activated this code, just a little example, most here could find a cleaner way to do it but this worked for me... if you want to gut my original code for your own use you can check it out at Project Deranjata here on WI. the file it is located in is config.lua Code:
|
All times are GMT -6. The time now is 03:36 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI