Quantcast
Looking For a Guide - WoWInterface
Thread Tools Display Modes
05-17-10, 10:43 PM   #1
MrLulz
A Murloc Raider
 
MrLulz's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 5
Looking For a Guide

With my newest addon I am working on I've decided it's time to start including some options.

I'm hoping someone can point me in the direction of an up to date guide of some sort to help with slash commands and/or interface options.

Anyone know of a good one?
  Reply With Quote
05-18-10, 05:38 AM   #2
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
slashcmds you can do this..

Code:
local function doThisFunction()
	print("pewpewrawr")
end

SlashCmdList['EXAMPLE'] = doThisFunction
SLASH_EXAMPLE1 = '/exampleslash1'
SLASH_EXAMPLE2 = '/exampleslash2'
this is limited tho, i used NugRunning to help me with slashcmds that have a variable.
  Reply With Quote
05-18-10, 05:56 AM   #3
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
This is not limited at all!

Code:
local function slash(arg)
	print(arg or "No arguments given.")
end

SlashCmdList["EXAMPLE"] = slash
SLASH_EXAMPLE1 = "/exampleslash1"
SLASH_EXAMPLE2 = "/exampleslash2"
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
05-18-10, 08:24 AM   #4
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Wowwiki has a short guide on creating slash commands.

http://www.wowwiki.com/Creating_a_slash_command
__________________
Oh, the simulated horror!
  Reply With Quote
05-18-10, 08:33 AM   #5
Fodaro
A Cyclonian
 
Fodaro's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 42
I think it depends how many options you want to have. Consolid8 (my chat addon) just has a few, so I use slash commands. The simplified handler goes something like this:
Code:
SlashCmdList["CONSOLID"] = function(msg)
	msg = string.lower(msg)
	if msg == "report" then
		Consolid8.Report()
	elseif msg == "show" then
		Consolid8.Show()
	-- ...
	else
		print("Command not recognized.")
	end
end
If you have a lot of commands, you may wish to use a table, e.g.:
Code:
switches = {
	report = Consolid8.Report,
	show = Consolid8.Show,
	-- ...
}

SlashCmdList["CONSOLID"] = function(msg)
	msg = string.lower(msg)
	if switches[msg] then
		switches[msg](msg)
	else
		print("Command not recognized.").
	end
end
To use the interface options, it's just a case of creating a frame and using an API function to register it, although I haven't done it personally.
__________________
Fodaro
(Main: Fodaro-Bronzebeard (EU))
Author of CharNote and Consolid8
  Reply With Quote
05-19-10, 06:58 PM   #6
MrLulz
A Murloc Raider
 
MrLulz's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 5
Thanks for all of this. Anyone know of a good place to look for saving and calling variables so I can save some settings to go along with this?
  Reply With Quote
05-19-10, 07:49 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,734
http://www.wowwiki.com/Saving_variab..._game_sessions
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Looking For a Guide

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