Alias/Trigger non alphanum character issue

Report bugs and suggest new features for the web client here.

Moderator: Eowul

Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Post Reply
User avatar
Mayobe
Adept
Posts: 133
Joined: 23 Jan 2016 08:28
Location: Bree

Alias/Trigger non alphanum character issue

Post by Mayobe » 29 Jan 2016 10:04

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

<Newbie>

and regex

\<Newbie\>

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.

User avatar
britanica
Wizard
Posts: 45
Joined: 28 Sep 2015 16:42

Re: Alias/Trigger non alphanum character issue

Post by britanica » 29 Jan 2016 12:47

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.

User avatar
Mayobe
Adept
Posts: 133
Joined: 23 Jan 2016 08:28
Location: Bree

Re: Alias/Trigger non alphanum character issue

Post by Mayobe » 29 Jan 2016 14:04

The info is appreciated. I do hope that it gets resolved soon though.

User avatar
Mayobe
Adept
Posts: 133
Joined: 23 Jan 2016 08:28
Location: Bree

Re: Alias/Trigger non alphanum character issue

Post by Mayobe » 03 Feb 2016 05:43

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.

User avatar
Vlek
Wanderer
Posts: 71
Joined: 06 Apr 2014 07:40
Contact:

Re: Alias/Trigger non alphanum character issue

Post by Vlek » 12 Feb 2016 08:37

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.

Pattern:

Code: Select all

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

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 ( gwc.userdata.music.enabled ){
  gwc.userdata.music.ding.play();
}

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/