General junk characters in chat messages
Reply
junk characters in chat messages

This post has some special characters in it that may not show up on some browsers. It shows up from Chrome on Windows for sure



Shendare just discovered an issue with character names showing up in chat. Specifically names in native chat channels, e.g. "Soandso tells you". Those names are now links you can use to report the message as spam. So there's some hidden characters before and after, and that can cause some unexpected results.

For example, if a character had the below event setup and someone named "Bob" did a group tell, this would echo "6" instead of "3" because there's 2 hidden letters on the front and 1 after Bob's name.

Macro
More +
#turbo

#event Whatever "#1# tells the group, #*#"

Sub Event_Whatever(string Line, string Sender)
   /echo ${Sender.Length}
/return


I'm thinking this probably wouldn't usually cause problems, but if it is, you can filter the special characters out by including them in a more explicit event string, like this:

this macro has special characters that you may not be able to see


Macro
More +
#turbo

#event Whatever "1#1# tells the group, #*#"

Sub Main
   :Loop
      /doevents
      /delay 2
   /goto :Loop
/return

Sub Event_Whatever(string Line, string Sender)
   /echo cleanName: ${Sender}
   /echo nameLength: ${Sender.Length}
/return


Still considering a way to clean it up> May just leave it and let the more explicit events handle it, or maybe adding a String.Trim that would cut off leading/trailing special characters/whitespace. Suggestions are welcome.
Sun Jul 15, 2018 1:27 pm
Project Lead
Thanks for the work, I remember having to use stuff like .Left[X] and .Right[Y] to parse "between the lines" in the past.
_________________
To be continued...
Wed Jul 18, 2018 7:30 pm
Listen to This Guy
General junk characters in chat messages
Reply