Page 1 of 1

Alias/Trigger non alphanum character issue

Posted: 29 Jan 2016 10:04
by Mayobe
I was trying to write a trigger for coloring noob chat earlier and it seems that it doesn't like to detect angle braces. I tried standard


and regex


but I had no luck with either.

Later on I was coloring health reports and noticed that "is at death's door." was not being colored. I changed it to "is at death" and it started working.

So it looks like there may be some issues with triggers parsing non alphanumeric characters?

Not a huge issue, but kind of annoying.

Re: Alias/Trigger non alphanum character issue

Posted: 29 Jan 2016 12:47
by britanica
Currently the trigger receives the text as the html string that will be displayed in a <div>

This means that using html encoding is currently required.

Code: Select all

' = '
>  = >
< = <

at death's door  =   at death's door
<Newbie> = <Newbie>

Google html encoding for a full list of characters that will be changed.

Re: Alias/Trigger non alphanum character issue

Posted: 29 Jan 2016 14:04
by Mayobe
The info is appreciated. I do hope that it gets resolved soon though.

Re: Alias/Trigger non alphanum character issue

Posted: 03 Feb 2016 05:43
by Mayobe
Okay, I'm running into this again.

I wrote this thing:

Code: Select all

Name: <knife and coin>
Type: regexp
Pattern: .*?(kni|dirk|dagger|stiletto|coin).*

Execute the following javascript:

var str = args[0].replace(/(knife|knives|dirks|dirk|daggers|dagger|stilettos|stiletto)/gi, '<span style="background-color: rgb(40,40,40); color: magenta;">$1</span>');
str = str.replace(/(coins|coin)/g, '<span style="background-color: rgb(64,64,64); color: yellow;">$1</span>');
gwc.output.replace(args[0], str, true);
And it works in general, but I noticed that it wasn't triggering in battle on lines like this:
You cut the watching small male orc's body with your jagged sharp knife.
So I tested by repeating the line and it's the apostrophe that's causing the failure.

Re: Alias/Trigger non alphanum character issue

Posted: 12 Feb 2016 08:37
by Vlek
That's some pretty funky alias writing.

Here's mine where I highlight newbie messages based on the user talking and add a timestamp instead of the "newbie" tab. Keep in mind this isn't going to be plug and play because I have base things saved in my userdata that you're obviously not going to have.


Code: Select all

Newbie> (\w+).*:.*

Code: Select all

if ( args[1] !== undefined ){
  //gwc.output.append( args.slice(1) );
  if ( gwc.userdata.newbie_messenger_list === undefined ){
  //Create the dictionary if it doesn't exist to house players:colors
  gwc.userdata.newbie_messenger_list = {};
  if ( gwc.userdata.newbie_messenger_list[ args[1] ] === undefined ){
  //Add the person to the list and assign them a color after randomly selecting an unused one
  gwc.userdata.newbie_messenger_list[ args[1] ] = gwc.userdata.random(gwc.userdata.colors);
  //Now finally color the message accordingly
  gwc.output.color( gwc.userdata.newbie_messenger_list[ args[1] ] );

var currentTime = new Date();
gwc.output.replace('Newbie', currentTime.getHours() + ':' + ( currentTime.getMinutes().toString().length > 1 ? '' : '0' ) + currentTime.getMinutes(), true);

if ( ){;