[Help] My first addon menu

User Tag List

Results 1 to 4 of 4
  1. #1
    DaigonoYouso's Avatar Sergeant Major The Fifth Element
    Reputation
    32
    Join Date
    Jan 2010
    Posts
    172
    Thanks G/R
    0/0
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help] My first addon

    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
    Last edited by DaigonoYouso; 07-25-2011 at 03:11 PM.

    [Help] My first addon
  2. #2
    DaigonoYouso's Avatar Sergeant Major The Fifth Element
    Reputation
    32
    Join Date
    Jan 2010
    Posts
    172
    Thanks G/R
    0/0
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ---bump---

  3. #3
    vabatta's Avatar Member
    Reputation
    5
    Join Date
    May 2008
    Posts
    31
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First, you make a mistake when handling the slash function
    Code:
    SlashCmdList["SECMDON"] = function () -- SEcmdTurnON() Here you need to do a local function without a name
    	if(SECMDONOFF = 1) then
    		DEFAULT_CHAT_FRAME:AddMessage("|cff404040ChatColor is already ON\124r.");
    	else if(SECMDONOFF = 0) then
    		SECMDONOFF = 1;
    	end
    end
    Then, if you want to create a function, why you don't use a sigle command with arguments and not 2 different command ?
    See this
    Code:
    SLASH_SECMDON1 = "/se"
    SlashCmdList["SECMDON"] = function(message)
         -- this will create a slash like this: /se on
         if message == "on" then
              -- what do you want when prompted "on" after /se
         else
              -- what do you want when prompted any other word after /se
         end
    end
    I hope that this helped you!

  4. #4
    plagueware's Avatar Member
    Reputation
    1
    Join Date
    Oct 2007
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good luck!

Similar Threads

  1. Quest Helper isn't working. (It's my first addon)
    By gameclub in forum World of Warcraft General
    Replies: 4
    Last Post: 02-18-2009, 08:44 AM
  2. Need help! "Head first C#"
    By [F]ear in forum Programming
    Replies: 5
    Last Post: 08-16-2008, 08:59 PM
  3. Help finding a addon
    By xsx in forum Community Chat
    Replies: 3
    Last Post: 07-25-2008, 11:30 PM
  4. Need help finding droprate addon!
    By Sonikk in forum World of Warcraft General
    Replies: 7
    Last Post: 04-02-2008, 11:51 AM
All times are GMT -5. The time now is 02:35 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search