Thread Tools Display Modes
04-26-09, 11:14 AM   #1
Nubsy
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 14
Slash commands

Hi ive been trying to set up slash commands for my mod to lock n unlock the frames without having to edit the lau or rl ui but im getting nxt to no were i get the slash commands to show but dnt no how to set up the code to change them can some 1 please help me .

what im using.
Code:
local oUF_nubsy = CreateFrame("Frame")

local settings = {
	"move_player",
	"lock_player",
}

oUF_nubsyDB = 2

function oUF_nubsy.SlashCommand(msg)
	local self = oUF_nubsy
	if strlen(msg) > 0 then
		local command = string.lower(msg)
		local help = true
		if ( type(command) == "string" ) then
			for i,v in ipairs(settings) do
				if ( command == string.lower(v) ) then
					self:Update(i)
					DEFAULT_CHAT_FRAME:AddMessage("oUF_nubsy: "..string.lower(v))
					help = false
				end
			end
		elseif ( type(command) == "number" ) then
			if settings[command] ~= nil then
				self:Update(command)
				DEFAULT_CHAT_FRAME:AddMessage("oUF_nubsy: "..string.lower(settings[command]))
				help = false
			end
		end

		if ( help == true ) then
			for i,v in ipairs(settings) do
				DEFAULT_CHAT_FRAME:AddMessage("oUF_nubsy: /nubsy "..v)
			end
		end
	else
		for i,v in ipairs(settings) do
			DEFAULT_CHAT_FRAME:AddMessage("oUF_nubsy: /nubsy "..v)
		end
	end
end

SLASH_NUBSY1 = "/nubsy"
SlashCmdList["NUBSY"] = oUF_nubsy.SlashCommand

Last edited by Nubsy : 04-26-09 at 12:05 PM.
  Reply With Quote
04-26-09, 11:18 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
use [ code ] not [ quote ]
  Reply With Quote
04-26-09, 12:05 PM   #3
Nubsy
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 14
Originally Posted by p3lim View Post
use [ code ] not [ quote ]
sorry changed now
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Slash commands


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