Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Tyka
Newbie


Joined: 03 Apr 2008
Posts: 2

PostPosted: 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?
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: 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."
Reply with quote
Tyka
Newbie


Joined: 03 Apr 2008
Posts: 2

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net