Hi, I decided to make my first addon, I wanted to create addon that if u will say "/seon" it will change color of your text and if u say "/seoff" it will return it back to normal, but when I test it in-game it just don't works, I don't get any error or something, only that "this command does not exist, say "/help" for command list" or something like this, here is my addon:
--this is for 3.3.5a
SEnergy.lua
Code:
SLASH_SECMDON1 = "/seon"
SLASH_SECMDOFF1 = "/seoff"
scm = SendChatMessage
Thing[0] = msg;
Thing[1] = "\124cffCC0000\124Hitem:19:0:0:0:0:0:0:0\124h(SEnergy!): \124cffFF6600\124Hitem:19:0:0:0:0:0:0:0\124h" ..msg.. "\124h\124r";
SECMDONOFF = 0;
SlashCmdList["SECMDON"] = function SEcmdTurnON()
if(SECMDONOFF = 1) then
DEFAULT_CHAT_FRAME:AddMessage("|cff404040ChatColor is already ON\124r.");
else if(SECMDONOFF = 0) then
SECMDONOFF = 1;
end
end
SlashCmdList["SECMDOFF"] = function SEcmdTurnOFF()
if(SECMDONOFF = 0) then
DEFAULT_CHAT_FRAME:AddMessage("|cff404040ChatColor is already OFF\124r.");
else if(SECMDONOFF = 1) then
SECMDONOFF = 0
end
end
function SendChatMessage(msg, type, language, chan)
scm(Thing[SECMDONOFF], type, language, chan);
end
SEnergy.toc
Code:
## Interface: 30300
## Title: |cffEE4000SE|cff404040nergy
## Author: SEnergy
## Version: 1.00
## eMail:
## DefaultState: Enabled
## LoadOnDemand: 0
SEnergy.lua
P.S.: This is rewrite of my first working "addon" from one book (I don't remember name), maybe it will help so here it is:
Code:
SLASH_CAU1 = "/cau"
SlashCmdList["CAU"] = function(self, txt)
if UnitExists("target") then
SendChatMessage(UnitName("target") .. " si zmrd!", "SAY")
else
SendChatMessage("Caute zmrdi!")
end
end
Code:
## Interface: 30300
## Title: Hey There!
## Notes: Provides slash commands to geet other players
HeyThere.lua