View Single Post
08-05-17, 11:59 AM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
I'm not sure if that was an actual question but if so, something like:
Lua Code:
  1. local msgList = {
  2.     { "GUILD", "Message 1" },
  3.     { "YELL", "Message 2" },
  4.     { "PARTY", "Message 3" },
  5. }
  6. local function PrintList()
  7.     print("Help commands = /ph or /sph\nOption = Send - Message:")
  8.     for i=1, #msgList do
  9.         print(i, "=", msgList[i][1], "-", msgList[i][2])
  10.     end
  11. end
  12.  
  13. SLASH_PHRASE1 = "/ph";
  14. SLASH_PHRASE2 = "/sph";
  15. SlashCmdList["PHRASE"] = function(msg)
  16.     if msg == "" then
  17.         PrintList()
  18.     else
  19.         local cmd = tonumber(msg)
  20.         if msgList[cmd] then
  21.             SendChatMessage(msgList[cmd][2], msgList[cmd][1])
  22.         else
  23.             print("Not a valid option")
  24.         end
  25.     end
  26. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote