Thread Tools Display Modes
03-08-23, 09:22 AM   #1
Adonator5000
A Defias Bandit
 
Adonator5000's Avatar
Join Date: Mar 2023
Posts: 2
Please help me with an addon

Hello!

I am new here but I saw that you known a lot about making addons etc
So I did an addon that is already working as intended but I am not getting how to make a slash command to launch my addon on the player's interface.

I am using the next code but I am keeping getting an Lua Error from it:

SLASH_NOVIDADE1 = "/Novidade"
SLASH_NOVIDADE2 = "/Novídade"

SlashCmdList["NOVIDADE"] = function ()
NOVIDADE_ToggleFrame();
end

Please can you help me? I just want to make the window of addon to appear for the player when he uses the command: /Novidade
Ty!
  Reply With Quote
03-08-23, 10:32 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
You don't tell us what the error says which would be helpful but...

The SLASH_NOVIDADE1, SLASH_NOVIDADE2 etc. are for different slash commands that call the same function (in case one gets overwitten by another addon or you want to have say, a full addon name command and an acronym command (but you only need one) eg.:
Code:
SLASH_NOVIDADE1 = "/novidade"
SLASH_NOVIDADE2 = "/nvd"
if NOVIDADE_ToggleFrame is defined as a local function, it needs to be declared before the SlashCmdList entry is created
Lua Code:
  1. local function NOVIDADE_ToggleFrame()
  2.     MyFrame:SetShown(not MyFrame:IsShown ())
  3. end
  4.  
  5. SlashCmdList["NOVIDADE"] = function(msg)
  6.      NOVIDADE_ToggleFrame()
  7. end

I have no idea what the NOVIDADE_ToggleFrame function does so the code is just for exmple.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-08-23 at 01:20 PM.
  Reply With Quote
03-08-23, 04:20 PM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
You need to move the NOVIDADE_ToggleFrame function code above (before)

Code:
SlashCmdList["NOVIDADE"] = function ()
    NOVIDADE_ToggleFrame();
end
in the .lua file.

so it looks something like:

Lua Code:
  1. local function NOVIDADE_ToggleFrame()
  2.     -- whatever the function code is
  3. end
  4.  
  5. SlashCmdList["NOVIDADE"] = function ()
  6.     NOVIDADE_ToggleFrame();
  7. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-08-23 at 04:27 PM.
  Reply With Quote
03-08-23, 10:13 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Originally Posted by Adonator5000 View Post
-- Can I put my entire code from addon here? It does not have a lot of lines
And ty for helping me! --
That would be helpful. You can use the code tags in the post editor (use the # or lua button).
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-09-23 at 08:15 AM.
  Reply With Quote
03-09-23, 02:56 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Sorry, I can't help with code for private servers. This site is for offical Blizzard games only.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-09-23, 03:19 PM   #6
Adonator5000
A Defias Bandit
 
Adonator5000's Avatar
Join Date: Mar 2023
Posts: 2
Ok, thank you.

Last edited by Adonator5000 : 03-09-23 at 03:27 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Please help me with an addon

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off