|
Tyka Newbie
Joined: 03 Apr 2008 Posts: 2
|
Posted: Thu Apr 03, 2008 8:43 pm
Ansi triggers |
Hi, I'm having some trouble with ansi triggers.
Example:
#TRIGGER {%e[36m(*)} {
#show %1
} "" {color}
That trigger works great, it will trigger on everything that is cyan(room name) and then write it to the screen.
The problems begin when i want to use %1 for something else than writing to the screen.
Example:
#TRIGGER {%e[36m(*)} {
#show %mapquery( {Name = '%1'})
} "" {color}
This will just print an empty line. So I thought that maybe i was entering the data wrong or the room didn't exist.
So i made another trigger, as i couldn't use * as a trigger(it would trigger everything). I asked my friend to send me a tell with the room name.
#TRIGGER {Dirk tells you '(*)'} {
#show %mapquery( {Name = '%1'})
} "" {case}
It worked and it printed out the room number(the room was unique). So what am I missing here? |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Thu Apr 03, 2008 8:52 pm |
use %stripansi() to remove unwanted ansi sequences from your string
Untested:
Code: |
#show %mapquery({Name = %stripansi(%1)}) |
Code: |
#TRIGGER {%e[36m(*)} {#show %len(%1)~[%1~];#show %len(%stripansi(%1))~[%stripansi(%1)~]} "" {color} |
Will show you the difference |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
Tyka Newbie
Joined: 03 Apr 2008 Posts: 2
|
Posted: Thu Apr 03, 2008 9:12 pm |
Dharkael wrote: |
use %stripansi() to remove unwanted ansi sequences from your string
Untested:
Code: |
#show %mapquery({Name = %stripansi(%1)}) |
|
I see, didn't think that they would send "%e[0m"(no color) on the same line.
So rewrote the trigger to "%e[36m(*)%e[0m".
Although I would never have figured it out without your help.
Thanks :D |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Apr 03, 2008 10:24 pm |
They actually have to do that or the colour will bleed through onto following lines. It's part of the telnet standard - the colour's only changed when the server explicitly changes it.
|
|
|
|
|
|