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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
AmongTheDecay
Beginner


Joined: 25 Apr 2009
Posts: 28

PostPosted: Sat May 16, 2009 4:37 am   

Colored Trigger and variable
 
I am trying to store the current room I am in in a variable (room) but it does not seem to be updating it ever.

The room name appears as centered red text on a line by itself whenever you enter a room. I tried making an ansi trigger copying it from the mud.

PATTERN: %e[0S %e[1;31m(%*)%e[0m$ (%*) = A Twisted Narrow Path

{#VARIABLE room %1}

Any other ideas on how to accomplish this?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat May 16, 2009 6:58 pm   
 
Use %s instead of %* (%* allows malicious gamers to take control of your mud character). If the $ is part of the ansi code, use ~$ instead otherwise it needs to go to the end of the pattern ($ is a special character used to denote the end-of-line anchor in a trigger pattern, the ~ tells the parser that you really want to match the next symbol literally so ~$ means you want to match a dollar-sign symbol). Try using a color trigger instead of an ansi one?
_________________
EDIT: I didn't like my old signature
Reply with quote
AmongTheDecay
Beginner


Joined: 25 Apr 2009
Posts: 28

PostPosted: Sat May 16, 2009 9:34 pm   
 
The (%*) is normally where the room name would be.

The ansi line with a name in it looks like this.

%e[0S %e[1;31mA Twisting Narrow Path%e[0m$

Yes the $ is to anchor the end line. I'm not sure how to use a color trigger with white space or centered text.

The whitespace seemed to be screwing up the trigger. I noticed it only stored on rooms with the same number of characters as I copied and pasted the example. When I trimmed down the trigger to just:

%e[1;31m(%*)%e[0m$

it worked fine but there are some instances it still messes up the trigger with room descriptions and objects in red. Is there anyway I can make the trigger to store the variable when the line contains some whitespace but not a set amount?
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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