Pretty big noob when it comes to coding. A friend of mine was helping me out with a project that has since been abandoned, and now I’m in the process of picking up the pieces and working out some of its old kinks.
The following code is my current focus:
function EmoteNonsense_CheckForNames(msg, sender)
local enWasFound = 0;
local enPlayerName, _ = UnitName("player")
if enNames ~= nil then
for i=1,#enNames do
local currentName = enNames[i]
if msg:find("%f[%a]" .. EmoteNonsense_NoCase(currentName) .. "%f[%A]") and enPlayerName ~= self then
EmoteNonsense_DoRaidWarning(sender)
EmoteNonsense_DoFlashClient()
enWasFound = 1;
msg = "|cFF"..enPlayerColour..">>|r"..msg
end
end
end
end
if enWasFound == 0 then
if msg:find("%f[%a]" .. EmoteNonsense_NoCase(enPlayerName) .. "%f[%A]") then
EmoteNonsense_DoRaidWarning(sender)
EmoteNonsense_DoFlashClient()
msg = "|cFF"..enPlayerColour..">>|r"..msg
end
end
return msg
end
The intent of this method is to “ping” the user when their character name is mentioned in chat, whispers, etc. However, the method also pings a player when they mention themselves, and that is what I don’t want.
I’ve tried adding a second condition, enPlayerName ~= self
but I don’t think I quite understand how to reference oneself, and thus this code does not work and will not ping at all regardless of who sends the message.
What would be the best way to say, “If the sender of the message is NOT me”?
Thanks for any help!