View unanswered posts | View active topics It is currently 19 Jul 2018 15:47

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.



Reply to topic  [ 5 posts ] 
Alias/Trigger non alphanum character issue 
Author Message
Adept
User avatar

Joined: 23 Jan 2016 08:28
Posts: 133
Location: Bree
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.


29 Jan 2016 10:04
Profile
Wizard
User avatar

Joined: 28 Sep 2015 16:42
Posts: 45
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:
' = &#39;
>  = &gt;
< = &lt;

at death's door  =   at death&#39;s door
<Newbie> = &lt;Newbie&gt;



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


29 Jan 2016 12:47
Profile
Adept
User avatar

Joined: 23 Jan 2016 08:28
Posts: 133
Location: Bree
The info is appreciated. I do hope that it gets resolved soon though.


29 Jan 2016 14:04
Profile
Adept
User avatar

Joined: 23 Jan 2016 08:28
Posts: 133
Location: Bree
Okay, I'm running into this again.

I wrote this thing:

Code:
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:
Quote:
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.


03 Feb 2016 05:43
Profile
Wanderer
User avatar

Joined: 06 Apr 2014 07:40
Posts: 71
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:
Newbie&gt; (\w+).*:.*


Code:
Code:
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();
}

_________________
Args Explained - Adv. Trigger Manip - Adding Audio


12 Feb 2016 08:37
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.