|
rderosier Beginner
Joined: 25 Sep 2009 Posts: 14
|
Posted: Sat Oct 03, 2009 6:48 pm
Coloring a room, based on the color of the room name |
Is it possible to make a trigger that will color the room on the map based on the color of the room name?
On the mud I play the room name is in gray if the room is nomagic, so it would be cool to have it automaticly color the rooms that are nomagic.
Thanks for any help in advance. |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Oct 03, 2009 8:23 pm |
Try %roomcol
|
|
|
|
rderosier Beginner
Joined: 25 Sep 2009 Posts: 14
|
Posted: Sat Oct 03, 2009 9:32 pm |
yea, %roomcol I know will color the room, but im not sure which command, if there is one, will recognize the room color in the title
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Oct 03, 2009 10:16 pm |
Don't need a command, just need a trigger.
1)make new trigger (for this particular example, it's actually easiest if you use the Package Editor UI and copy-paste the text)
2)click the ANSI trigger checkbox
3)paste the pattern containing the grey color into the pattern box (because of #2, the ansi codes will be included automatically as a CMud feature)
4)leaving the ansi codes alone, change the roomname text to a pattern that safely matches all room names.
5)include the command #CALL %roomcol(,valid color code, number, or name goes here) |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
rderosier Beginner
Joined: 25 Sep 2009 Posts: 14
|
Posted: Sun Oct 04, 2009 6:22 am |
Ok, im pretty close. when I copy and paste the room name it looks like
%e[1;30mStables of the Friendly Perch%e[0m
as an example of one room, I thought
%e[1;30mS%roomname%e[0m
would work to cover all the rooms I walked into but it only worked once and doesnt seem to want to work at all after the first time.
Am I missing something or is %roomname the totally wrong command for that?
Thanks for the input |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Oct 04, 2009 4:03 pm |
totally wrong. Patterns require pattern-matching wildcards, not functions.
^%e[1;30m[%w%s]%e[0m$
^ means to only match at the start of the line
$ when at the end of the pattern, it means to match the end of the line
[] means to match any combination of the wildcards or characters contained within
%w means to match any continuous combination of letters (ie, cat, dog, mouse, antidisestablishmentarianism)
%s means to match any continuous combination of whitespace |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
rderosier Beginner
Joined: 25 Sep 2009 Posts: 14
|
Posted: Sun Oct 04, 2009 7:58 pm |
Ok, thank you for all the help, there's just one more problem, when im mapping it colors the room previous to the room I walked into that's nomagic and that should be colored.
The trigger must fire before it registers the change in my position on the map maybe? Im not sure. Ideas?
Thanks again |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Oct 05, 2009 2:51 am |
Yes, it is firing before it decides you have actually moved, and before the new room is created. What you could do is have this trigger set some variable, then make an onRoomCreate event which checks the value of this variable and sets the room color appropriately. The event would then have to unset or change the variable.
|
|
|
|
Syberchick Newbie
Joined: 22 Jun 2010 Posts: 2 Location: WV
|
Posted: Sun Jul 11, 2010 11:47 pm |
Fix that problem by putting in a really short #wait statement.
This works for me:
#wait 50
#NOOP %maplocked( 0)
#CALL %roomcol(,"brown")
#NOOP %maplocked( 1) |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jul 13, 2010 1:22 pm |
It is generally not useful to reply to posts which are nine months old.
|
|
|
|
|
|