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
omniwing
Beginner


Joined: 02 Jun 2006
Posts: 19

PostPosted: Sun Jan 10, 2010 6:04 am   

How do I store a string of text as a variable, just by color
 
I want to store a string of text as a variable, based only on its color alone. So, it could be ANY line of text, however, if its in a certain color, then I store it as a variable.

For a concrete example, the room names on my MUD are always in light blue text, and its the only light blue text in the game. So whenever a room name comes up, I want to store the room name in a variable. However, since I don't know what the text is going to be, I don't know how to trigger and capture it. Ideas? Please help.
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Sun Jan 10, 2010 3:11 pm   
 
#TRIGGER {(*)} {roomname=%1} "" {line=11}

The line=11 part was chosen using the Line Color option for triggers, I chose the cyan since it's the closest to light blue that ANSI has.
_________________
Taz :)
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jan 10, 2010 6:19 pm   
 
Heh, it's not the closest that ANSI has. Instead of using line color, you could use the ANSI option, which allows you to take advantage of the 31;34m format that ansi color comes in. Unless you already know the ansi value of your line of text, just copy an example, paste it into the pattern box in the Package Editor, and change the words to whatever wildcards are needed. The ansi code part will be automatically inserted by CMud, but this only works via the package editor.

Oh, I forgot to mention that the ansi codes are only inserted when the trigger is already set to be an ANSI trigger, so do that first.
_________________
EDIT: I didn't like my old signature
Reply with quote
omniwing
Beginner


Joined: 02 Jun 2006
Posts: 19

PostPosted: Sat Jan 23, 2010 6:13 am   Update!
 
Okay, so it is kind of working. I'm using pattern (*) and the value roomname=%1 , and under options I have it set to the correct line color.

It works fine, when the room name is on a new line. However, in many cases, my prompt is shoved up next to the roomname. So it will look like this:

<653/653|97/97|1596/|/ Western Temple Square

Now, when that happens, it does not trigger. How can I fix this?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jan 23, 2010 6:52 am   
 
Your best option is to change the prompt the game sends you so that it always ends with a carriage return. Not all games have this, though.

After that, you can try matching your prompt and #sub in a carriage return version so that the combined lines like you have never happen. That might cause problems with triggers not firing, however, but I forget if ZMud acts like this for subbed text or not.

Lastly, and I also forget if this is true in ZMud or not, you can try using ANSI codes instead of the line color option. Line color has a "the entire line" restriction, so any result like above means the trigger doesn't fire. ANSI triggers might not have that problem.
_________________
EDIT: I didn't like my old signature
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