Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-19-12, 12:22 PM   #1
epicskillz
A Murloc Raider
Join Date: Sep 2012
Posts: 4
Slashcommand handler acting weird

Code:
function SlashPMS(msg, editbox)
  print("Entered /command handler " .. msg)
  PMSEncode(msg)
end

SLASH_PMS1 = "/pms";
SlashCmdList["PMS"] = SlashPMS;



--[[local function PMSEncode(msg)
  endResult = ""
  if msg == "" then
    print "Blank string."
  else
    print(string.len(msg))
    for i = 1, string.len(msg)-1, 1
      print("i")
--      encode = endResult .. PMSLetterEncoded(string.sub(msg,i,i+1) .. " "
    end
  end
  
  SendChatMessage(endResult, "SAY", "", "");
end 

local function PMSLetterEncoded(s)
  if s:len() > 1 then 
    return "0"
  else 
    return "1" -- here be the magic for output
  end
end

local function echo(str)
  print("|cfffef00fPMS |cff82e2eb" .. (str or ""))
end
--]]
I'm trying to make an addon that can "encode" your /say things. One day I might even implement a decoder, but that is a long way off.

First of all, as you see now, EVERYTHING except the slashhandler is commented out. Then it works.

If i do as little as uncomment the 3 functions, i just get /pms not recognized.

(Yes, PMS means Panzer's Messaging System. I also thought it was hilarious..)

Any help please?

My addon needs no GUI, my plan was to write /pms <any text> , and it would come out in /say as encoded text. Will that need any events(handlers)? I have somewhat experience with programming, but only been using lua for 40 mins, and never seen event-driven programming, so bare with me.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Slashcommand handler acting weird


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