Quantcast
WoWInterface - View Single Post - One slash command for two action
View Single Post
05-25-21, 11:06 AM   #3
darhanger
A Murloc Raider
 
darhanger's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2017
Posts: 9
Originally Posted by Fizzlemizz View Post
The function for a slash commands has a single string parameter you can use for different actions:

Lua Code:
  1. SLASH_MYSLASHFUNCTION1 = "/ms"
  2. SlashCmdList.MYSLASHFUNCTION = function(msg)
  3.     local name  = UnitName("player")
  4.     if msg:upper() == "HI" then
  5.             print("Nice day to you " .. name)
  6.     elseif msg:upper() == "BYE" then
  7.             print("Time to go " .. name)
  8.         end
  9. end

Code:
/ms hi
/ms bye
what if i wanna use just /ms to turn something one and /ms to turn off? without adding worlds like /ms on or /ms off ?
  Reply With Quote