Does anyone know the first character of a link as parsed by SendChatMessage? I don't mean a link like \124Hitem:12345\124h[Item]\124h. I mean a shift-clicked link. I am attempting to re-write the script for the ColorMe addon but my script breaks shift-linking spells/items/etc. So far, everything else is supported. Commands, / commands (mainly /afk), etc.
I've tried using if string.sub(msg,1,1)=="\\", if string.sub(msg,1,4)=="\124", if string.sub(msg,1,1)=="|", and if string.sub(msg,1,1)=="[" but nothing seems to be picked up.
I tried doing
Code:
/script if (not scm) then scm=SendChatMessage end; function SendChatMessage(msg,type,lang,chan) scm(string.sub(msg,1,5),type,lang,chan) end
to get it to return the first 5 characters of the link, but all it seemed to do was send a null string. When I did the same thing using print() instead of scm(), it would show something like "|cff", "|cf", "cf", or "cff"
My current script is
Code:
/run if (not ss) then ss = string.sub end if(not scm) then scm = SendChatMessage; end; function SendChatMessage(msg, type, lang, chan) if ss(msg,1,1)=="\." or ss(msg,1,1)=="\\" or type=="AFK" or type=="EMOTE" then scm(msg,type,lang,chan); else scm("\124cff<color code>"..msg.."\124r", type, lang, chan); end; end
That will let you successfully color your chat and do everything except shift-link items. It will color all chat except any made with a . command.