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
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Jan 07, 2003 8:04 pm   

Changing room color in mapper
 
I am mapping rooms, but I want to change the room color of the room according to the roomname color from the mud. Also the exit line must have....
Primary exits: none (other exits:
In the exit line.
Example text from mud.
The Beach
The beach is home to small amounts of drift wood that have washed onto
the sands among the sea shells.

Primary Exits: none (other exits: n, s, w, ne, nw, sw)
A white seagull flutters on the wind.
<61hp 153mv>


Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Wed Jan 08, 2003 3:37 pm   
 
:bump:

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Jan 08, 2003 4:04 pm   
 
The room name can be various colors and you want the room to have the same color as the room name? Also this should only happen when the primary exits is none?

Kjata
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Wed Jan 08, 2003 5:09 pm   
 
Yes, that is correct.

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Jan 08, 2003 7:26 pm   
 
You can use %roomcol for this. For this, you would need to create various ansi triggers to fire on the room name. One possible way to do it is that when one of these triggers fire, it sets a variable to contain the desired color. You could then have a push button or alias that sets the color using %roomcol:
#NOOP %roomcol(, @color)

It is best if the room color is set by user action like pushing a button, executing a macro or calling an alias (done by you, not code), because you can't change the color until the mapper if finished adding the room and there is no easy way to determine this moment.

Kjata
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Thu Jan 09, 2003 5:32 am   
 
Kjata
quote:
For this, you would need to create various ansi triggers to fire on the room name.

I am a little confused here. How am I going to have it trigger on the Room Name when I don't know what the name is. I am doing this while I am mapping.
As for %roomcol function, I was doing this but it was coloring the room that I leave not the current room I am in.


Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Jan 09, 2003 1:21 pm   
 
You can get the room name with because it is the first line that comes after you enter a direction command. A state trigger achieves this:
#ONINPUT {%t} {}
#COND {*} {#VAR color color}

Now, the second state will fire on any line, but you can make this state and ansi trigger and then include some ansi codes so it inly fires on a room name of a specific color.

Also, be sure you use %roomcol after the room is created and the current location marker is moved to the newly created room. Otherwise, it will color the wrong room, like you said.

Kjata
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Thu Jan 09, 2003 6:58 pm   
 
Kjata,
I not sure if I understand the "States".
So if I want to capture the color of the RoomName and then color the room the same color as the Room Name I just use the above trigger?

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Jan 09, 2003 7:24 pm   
 
First, I am assuming you are using 6.40. Trigger states are a new addition to conventional triggers and you can read more about them here.

The trigger itself will not color the room. It could, but it doesn't. The reason why it doesn't do that is because you can't change the color of a room by code until the mapper is done creating the room. Finding this moment is not easy and to avoid errors, it is best to leave it up to the user when to color the room. Having said that, here is an example (I've changed the system a bit to only use one trigger to avoid possible complications):
#ONINPUT {%t} {}
#COND {(*)} {#VAR line {%trigger};#IF (%begins(@line, %concat(%char(27), "[1;31m"))) {#VAR color red}} {color}

The code for bright red 31 and to make it bright it uses 1. That's why the trigger checks for the presence of %e[1;31m. There would have to be other #IF's to check for other colors and set @color to the correct color.

Then, there is an alias (button, macro or whatever you like) like this:
#ALIAS setcol {#NOOP %roomcol(, @color)}

You call this alias yourself when you have seen that the mapper has finished creating the room.



Kjata
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Thu Jan 09, 2003 8:33 pm   
 
I am trying this and I am not getting any room to color. I don't think it is capturing the colors.

#CLASS {color}
#ONINPUT {%t}
#COND {(*)} {#VAR line {%trigger};#IF (%begins( @line, %concat( %char( 27), "[1;31m"))) {#VAR color red};#IF (%begins( @line, %concat( %char( 27), "[1;32m"))) {#VAR color brightgreen};#IF (%begins( @line, %concat( %char( 27), "[1;37m"))) {#VAR color white};#IF (%begins( @line, %concat( %char( 27), "[1;33m"))) {#VAR color yellow;#show It's yellow.}} {color}
#COND {Primary Exits: none} {#NOOP %roomcol( , @color)}
#CLASS 0

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Sat Jan 11, 2003 12:13 am   
 
:bump:

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jan 11, 2003 2:53 am   
 
I repeat: you can't set the color by code while mapping. By the time the exits are displayed, the room is not finished being created and the room will not be colored. What you have will only color the room if the room has already been created and you enter the room again in Map Mode.

However, check the value of @color to make sure that the triggers is even firing correctly. I am not there to see for myself why it is failing.

Kjata
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Jan 13, 2003 5:30 am   
 
I think I know why it isn't working, but I am not sure why. When I capture #VAR line, it is capturing the prompt not the next line with the room name. hmmm

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Jan 13, 2003 11:54 am   
 
Ok, there we go. The trigger was made with the assumption that the room name is the first line displayed right after you send a direction command to the MUD. Modify the trigger so that the room name is captured correctly. If you don't know how, post MUD output where it shows you sending a direction command and the room you moved into.

Kjata
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Jan 13, 2003 7:44 pm   
 
Here is the same of the mud output:

62hp 154mv> n
A Path on the Beach
The ground this far inland is more rugged and broken then what can be
seen closer dock at the water's edge to the south. Scattered clumps of
tall grass grow nearby, thickening the closer they grow to the
buildings to the north.
Primary Exits: north south
A guard is watching the area.
The hair on the back of this dog bristle as it moves.

<62hp 156mv> n
Approaching the Village
The land is rock covered and uneven with few signs of plant life nearby
beyond a scattered cluster of grass. A dirt filed path, lined with more
stones, begins here and runs northward past a large structure to the
northeast.
Primary Exits: north south

<62hp 155mv> n
A dirt Path
A tall, wooden building rises to the east. Its wall is
pierced by a single small window. This dirt path continues
past the building running north and south.
Primary Exits: north south
A board, covered with notices, has been erected near the wall.

<62hp 154mv>

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jan 14, 2003 2:09 am   
 
Seems zMUD handles incorrectly a pattern state that comes after an oninput state. A quick fix is to change the pattern of the second state from:
(*)
to:
*$(*)

Kjata
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Jan 14, 2003 5:32 pm   
 
When I change the line to *$(*) the variable line now is capturing the prompt,direction and roomname:
<62hp 156mv> s
A Path on the Beach
How can I split this up to find the ansi code for the Room name only?

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jan 14, 2003 9:25 pm   
 
I'm sorry, that's my fault. This time, it should work. Change the pattern of the second state to:
*$&%*{line}

and delete the line in the second state that says:
#VAR line {%trigger}

Kjata
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Tue Jan 14, 2003 10:35 pm   
 
When I changed it to that pattern it doesn't trigger at all.

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Jan 15, 2003 2:18 am   
 
Pattern in reply above corrected.

Maybe I shouldn't post when I am tired.

Kjata
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