But when the next line executes with the function I get this error:
[2008/05/15 13:49:46-3754-x1]: SendChatMessage(): Invalid escape code in chat message:
<in C code>: ?
<in C code>: in function `SendChatMessage'
Chatter-1.0\Modules\ChatLink.lua:59: in function <Interface\AddOns\Chatter\Modules\ChatLink.lua:52>
(tail call): ?:
Incubator-2.00\IncubatorFuBar.lua:97: in function `OnClick'
FuBarPlugin-2.0-63898 (AutoBar):947: in function <...Ons\AutoBar\libs\FuBarPlugin-2.0\FuBarPlugin-2.0.lua:944>
FuBar-3.0.52967\FuBar.lua:1200: in function <Interface\AddOns\FuBar\FuBar.lua:1198>
Edit: forgot Incubator.db.profile.precision = true/false. I also tried it without this paramater at all with same resulting error.
Edit2: and I tried it without chatter running same error without the chatter part.
You need to strip out the |4 escape codes to be able to send the text properly.
num = string.match(a, "(%d) |4")
if num <= 1 then
a = gsub(a, "|4(.-):.-;", "%1")
a = gsub(a, "|4.-:(.-);", "%1")
The above is untested, and would only work if there is only one |4 escape code in the string. You may need to do extra parsing otherwise if there are more than one |4 escape codes to determine which string to use.
Well if there is no generic string function that turns plural escaped strings into normal ones, it may be worth suggesting adding it, certainly that function is already in SetText() but one may want to do this without a fontstring.
I would suggest it but I'm on the darn EU side of the iron curtain called UI feedback.
I am getting the same error doing a SendChatMessage() to send a notification to guild chat to announce a "ding". In this message I want to include my /played information so I have the following code to get time played in string:
if (event == "TIME_PLAYED_MSG") then
if (arg1 ~= nil) then
--Get time played
timePassed = SecondsToTime(arg1);
then to send the message I do:
SendChatMessage("Ding Notification!!! - I just reached level " .. newlvl .. " in " .. timePassed, "GUILD", nil,nil);
Yes I know, topic is dead. Found this trough Google and if anyone is looking for the answer they will hopefully find it.
timestring = SecondsToTime(seconds);
timestring = timestring:gsub("(%d) |4(%a+):(%a+);", function(num, single, plural)
if ( num == 1 ) then
return num .." ".. single;
return num .." ".. plural;
I don't know if all languages use the plural suffix for 0 (e.g. 0 Minutes), else you'll have to use some localisation in there.