 |
AmongTheDecay Beginner
Joined: 25 Apr 2009 Posts: 28
|
Posted: 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? |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
 |
AmongTheDecay Beginner
Joined: 25 Apr 2009 Posts: 28
|
Posted: 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? |
|
|
 |
|
|