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 Goto page 1, 2  Next
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Sun Aug 14, 2005 5:16 am   

ansi trigger question
 
Im trying to create a trigger that fires when it sees a certain color. It works fine except that it is copying the esc character aswell. My trigger pattern looks like

%e[1;35m(*)

im taking anything yellow and storing it into %1. The thing is if i do #show %1 it will look fine but if i do say %1 it will append something on the end such as ESC[0m or [0m So if %1 held the room name called The Garden it would show "The Garden" if i did #show %1 but doing say %1 would show "The Garden[0m". I tried to use %replace to edit the last part out but it ignored it. Any help on this would be awsome, thanks.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Aug 14, 2005 10:47 am   
 
%stripansi
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Sun Aug 14, 2005 3:58 pm   
 
Well i actually played around with stripansi after i posted. The thing is stripansi seems to work for one line things such as room names, but when I have a whole room description stored, stripansi doesnt seem to work at all, i still see the same thing. Im trying to figure this out because after trying and trying to get zmud to map a mud i play, i figured it would be much easier to just tell the mapper to put anything in a certain color in a variable and use that as the room description. Only thing now is i cant seem to get it working correctly.
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Sun Aug 14, 2005 4:58 pm   
 
For example, with the follow trigger the mapper finds the desc perfectly, except for the above problem.

#TR {%e[1;35m(*)} {#tag desc %1} will give me mud output like so:

The cobblestones of this ancient road are worn, and some have been torn loose from the muddy ground. Dense forest covers the verdant countryside to the north and to the south. A trail leads north to the graveyard, and this road continues west toward the City of Medievia. There is a rotting wooden sign hammered into the ground at the edge of the road.

if i try to run %1 through %stripansi first, it will just display "the ground at the edge of the road."
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Aug 14, 2005 5:45 pm   
 
Quotes are your friend! *untested*

#TR {%e[1;35m(*)} {#tag desc %stripansi("%1")}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Sun Aug 14, 2005 6:25 pm   
 
Amazing, thanks.
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Sun Aug 14, 2005 6:57 pm   
 
Blast, i fix it so it picks the right room description every time, yet i cannot not get it to pick the room name. This should be so simple, i created the same type of trigger, only this time for a differnt color, made it #tag name %1 and it even shows up when i do #show %1 as the correct room name, but when i go to configure the mapper, it skips the room name every time.
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Sun Aug 14, 2005 7:13 pm   
 
Ok i take it back about everything really, i was messing around with it trying to get name to work and then when i think its working right, i check the description of the room and i get:

%stripansi("The main room of the caretaker's house appears to serve as his office. A small") %stripansi("desk holds papers and maps, and there are chairs for patrons of the graveyard") %stripansi("to rest while waiting. Two hurricane lamps are set into brass sconces on the") %stripansi("walls, and they fill the room with a warm glow. A doorway in the south wall") %stripansi("appears to lead into a comfortable kitchen.") not sure why its doing all that, but hopefully i can get some help. Thanks
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Aug 15, 2005 7:37 am   
 
Post a capture of movement into a room with all the ansi codes. Include from the prompt where you press a direction until the prompt after the movement is complete. Also post the triggers you have so far, and we will see if we can make something that always works.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Mon Aug 15, 2005 3:43 pm   
 
The ansi codes should be like so, ill post the same thing done with html color so its easy to see. The items have no ansi code and so i left black.


%e[1;34m<223hp 225m 567mv 100br> w

%e[1;33mMarket Street, East of the Main Courtyard
%e[1;35mA light twilight effect is caused by the edges of the shadow cast by Castle
Medievia, serenely floating to the west. Further to the east the shade recedes
to allow normal lighting from the sun, although the magical shield surrounding
the city dims the glare somewhat. A small row of sparkling white pots sits
along the side of the street to the north, filled with bright posies and serene
daisies.
%e[1;32mA commoner of Medievia is wandering the city, admiring the surroundings.
%e[1;32mA short man dressed in colorful attire is here, peddling his wares.
%e[1;34mObvious exits:
East - Market Street
South - The Edge of Oblivion
West - The Main Courtyard of Medievia

%e[1;34<224hp 225m 564mv 100br> e

%e[1;33mMarket Street
%e[1;35mThe cobblestones that form the main thoroughfare here are soiled from the
passage of many a shopper, and the small army of janitors that the city employs
seems powerless to prevent the litter. Many of the people are moving either to
or from the market to the north, the cries of the stallholders just audible
over the hubbub of the citizens. To the south stands a low building with a red-
tiled roof and an ornate plasterwork decoration beneath the eaves.
A scroll has been carelessly left here.
A long sword has been left here.
%e[1;32mA short man dressed in colorful attire is here, peddling his wares.
%e[1;34mObvious exits:
North - The Southwestern Entry to the Market
East - Market Street
South - Asylum of the Banished
West - Market Street, East of the Main Courtyard

%e[1;34m<227hp 225m 563mv 100br>





<223hp 225m 571mv 100br> e

Market Street
The cobblestones that form the main thoroughfare here are soiled from the
passage of many a shopper, and the small army of janitors that the city employs
seems powerless to prevent the litter. Many of the people are moving either to
or from the market to the north, the cries of the stallholders just audible
over the hubbub of the citizens. To the south stands a low building with a red-
tiled roof and an ornate plasterwork decoration beneath the eaves.

A scroll has been carelessly left here.
A long sword has been left here.
A short man dressed in colorful attire is here, peddling his wares.
Obvious exits:
North - The Southwestern Entry to the Market
East - Market Street
South - Asylum of the Banished
West - Market Street, East of the Main Courtyard


<223hp 225m 567mv 100br> w

Market Street, East of the Main Courtyard
A light twilight effect is caused by the edges of the shadow cast by Castle
Medievia, serenely floating to the west. Further to the east the shade recedes
to allow normal lighting from the sun, although the magical shield surrounding
the city dims the glare somewhat. A small row of sparkling white pots sits
along the side of the street to the north, filled with bright posies and serene
daisies.

A commoner of Medievia is wandering the city, admiring the surroundings.
A short man dressed in colorful attire is here, peddling his wares.

Obvious exits:
East - Market Street
South - The Edge of Oblivion
West - The Main Courtyard of Medievia

<224hp 225m 564mv 100br>




Thats the setup i have. As you might tell i would like to set the mapper up to map the colors to room name ect. Otherwise it adds mobs and items to the desc.
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Mon Aug 15, 2005 4:29 pm   
 
oh and my triggers i had were
#TR {%e[1;35m(*)} {#tag desc %stripansi("%1")}

#TR {%e[1;33m(*)} {#tag name %stripansi("%1)}
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Mon Aug 15, 2005 5:51 pm   
 
PCs, NPCs, blood and any number of other things can be very annoying when trying to map Medievia. This script works almost flawlessly in Medievia.

Mainly two triggers:

#TRIGGER "roomname" {^%e[1;33m(*)} {#VARIABLE InRoom 1} "" {color}
#COND {Obvious exits:} {#VARIABLE RoomName %stripansi("%t1")}
#COND {({North|South|East|West|Up|Down})%s- *} {#VARIABLE RoomExits %trim(%concat(@RoomExits," ",%1))} {manual}
#TRIGGER {%e[1;35m(*)} {#IF (@InRoom) {#IF (@RoomDesc) {#VARIABLE RoomDesc %concat(@RoomDesc,%crlf,%stripansi("%1"))} {#VARIABLE RoomDesc %stripansi("%1")}}} "" {color}

And one alias:

#ALIAS checkroom {#IF (@InRoom) {#STATE "roomname" 0;#IF ((@RoomDesc) AND (@RoomExits)) {#TAG name,descpara,exit {@RoomName} {@RoomDesc} {@RoomExits};#VARIABLE RoomDesc %null;#VARIABLE RoomExits %null};#VARIABLE InRoom 0}}

Of course, you'll also need the variables.
#VAR InRoom {0}
#VAR RoomName {The End of the Avenue}
#VAR RoomDesc {}
#VAR RoomExits {}

Here's a generic prompt trigger for the checkroom alias.

#TRIGGER {<%d/%dhp %d/%dm %d/%dmv} {checkroom} "" {nocr|prompt}

This one is to make the mapper stop confusing itself.

#TRIGGER {*} {#NOMAP}


I wrote this script some time ago just to see if I could map Medievia without the mapper capturing all the other room objects. I haven't used it since. You will increase the success rate of this script by turning off all the unnecessary output like shouts, auction channel, herobattle channel, etc. Anything that starts with a yellow or magenta color.

If you improve upon this script, please let me know. My primary character in Medievia is also named Carabas.

Edit: Don't forget to reconfigure the mapper.
_________________
Carabas
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Mon Aug 15, 2005 6:31 pm   
 
I tried it like you pasted but it still messed up, such as mapping mobs and blood. I added a few triggers to #NOMAP anything colored green and red as to not map mobs and blood, but i have no clue how to get items to be excluded from the description since they have no ansi color to look for.
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Mon Aug 15, 2005 7:01 pm   
 
Hmm. I tested it just before I posted and everything worked fine. You shouldn't need to #NOMAP anything else because that one trigger is #NOMAPping everything. The rest of the script is feeding the room name, description, and exits directly to the mapper.

While you are connected to Medievia, try this.

#SAVE
#LOAD default
#SAVE MedTest

Copy/Paste the following into the command line:

Code:
#CLASS {RoomCap}
#ALIAS checkroom {#IF (@InRoom) {#STATE "roomname" 0;#IF ((@RoomDesc) AND (@RoomExits)) {#TAG name,descpara,exit {@RoomName} {@RoomDesc} {@RoomExits};#VARIABLE RoomDesc %null;#VARIABLE RoomExits %null};#VARIABLE InRoom 0}}
#VAR InRoom {0}
#VAR RoomName {The End of the Avenue}
#VAR RoomDesc {}
#VAR RoomExits {}
#TRIGGER "roomname" {^%e[1;33m(*)} {#VARIABLE InRoom 1} "" {color}
#COND {Obvious exits:} {#VARIABLE RoomName %stripansi("%t1")}
#COND {({North|South|East|West|Up|Down})%s- *} {#VARIABLE RoomExits %trim(%concat(@RoomExits," ",%1))} {manual}
#TRIGGER {<%d/%dhp %d/%dm %d/%dmv} {checkroom} "" {nocr|prompt}
#TRIGGER {%e[1;35m(*)} {#IF (@InRoom) {#IF (@RoomDesc) {#VARIABLE RoomDesc %concat(@RoomDesc,%crlf,%stripansi("%1"))} {#VARIABLE RoomDesc %stripansi("%1")}}} "" {color}
#TRIGGER {*} {#NOMAP}
#CLASS 0


Fire up the mapper and test it. If it works, then it is likely that you have other triggers interfering with this script.

To get your previous settings back do this:

#LOAD Medievia\Medievia

P.S. I just tried this exact procedure and it worked perfectly for me.
_________________
Carabas
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Mon Aug 15, 2005 7:04 pm   
 
Also, make sure that the generic prompt trigger I provided actually matches your prompt.
_________________
Carabas
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Aug 15, 2005 9:02 pm   
 
If Carabas's scripts still give you trouble please post again and I will whip up something. It looks like he has a very solidly made script though, and you should have no problems with it.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Tue Aug 16, 2005 1:30 am   
 
Well it really seems your script should work. I did your instructions, but when i reconfigure the map everthing is missing, and it doesnt map anything. I make sure my prompt matches yours, i just cant figure it out, it seems the (*) #nomap is throwing it off somehow.
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Tue Aug 16, 2005 11:23 am   
 
When you configure the mapper with this script, it will not show you what it parsed. It will just say congratulations, etc. Finish the reconfigure and start mapping. It *should* work. If it still doesn't work, I'll see if I can figure out why.
_________________
Carabas
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Tue Aug 16, 2005 7:57 pm   
 
Tried it agian and walked around a bit and here is what happens after walking 3 rooms. When looking at the variables it seems its storing the information of each room, so roomdesc has the description of every room i walked through, and exits has all the exits of every room i walked through. Also the mapper doesnt add any of this to the rooms it creates, it just creates a blank room. Hope that helped.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Aug 16, 2005 9:13 pm   
 
It seems you have to modify Carabas's script a little, the changes follow:

#TRIGGER "roomname" {^%e[1;33m(*)} {#VARIABLE InRoom 1} "" {color}
#COND {Obvious exits:} {#VARIABLE RoomName %stripansi("%t1")}
#COND {({North|South|East|West|Up|Down})%s- *} {#VARIABLE RoomExits {%concat(@RoomExits,"|","%1")}} {within|param=6}
#UNALIAS checkroom
#ALIAS onroomcreate {#IF (@InRoom) {#STATE "roomname" 3;#IF ((@RoomDesc) AND (@RoomExits)) {#NOOP %roomname(,@RoomName) %roomdesc(,@RoomDesc);#FORALL @RoomExits {#IF (%ismember("%i",%roomexit)=0) {#NOOP %roomlink(,"%i",-2)}};#VARIABLE RoomDesc {%null};#VARIABLE RoomExits {%null};#VARIABLE InRoom {0}}}

These changes allow the mapper to create a blank room then fill in the data with what was captured. While technically not required it is shorter to produce this set of triggers then describe the correct mapper configuration to allow the mapper to properly detect all this on its own. From your example rooms though, I know it can.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Tue Aug 16, 2005 9:48 pm   
 
Almost there, except after configuring the mapper, it sends {#IF
to the mud, giving a "Thou must be confused" error. I tried to find where it was coming from and delete the { infront of the if but had no luck.
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Tue Aug 16, 2005 11:15 pm   
 
talith wrote:
Almost there, except after configuring the mapper, it sends {#IF
to the mud, giving a "Thou must be confused" error. I tried to find where it was coming from and delete the { infront of the if but had no luck.


The problem is the onroomcreate alias.

#ALIAS onroomcreate {#IF (@InRoom) {#STATE "roomname" 3;#IF ((@RoomDesc) AND (@RoomExits)) {#NOOP %roomname(,@RoomName) %roomdesc(,@RoomDesc);#FORALL @RoomExits {#IF (%ismember("%i",%roomexit)=0) {#NOOP %roomlink(,"%i",-2)}};#VARIABLE RoomDesc {%null};#VARIABLE RoomExits {%null};#VARIABLE InRoom {0}}}}

I'm gonna try Vijilante's changes. Looks better than my solution Smile
_________________
Carabas
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Aug 17, 2005 12:29 am   
 
Oops, missing brace. I thought I counted those twice. Guess I still missed it.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Wed Aug 17, 2005 12:57 am   
 
Hmm. Didn't work consistently for me. I haven't had to the time to figure out why though.

I have a slightly updated version of my script from earlier this evening if anyone is interested.

Code:
#CLASS {RoomCap}
#ALIAS checkroom {#IF (@InRoom) {#VARIABLE InRoom 0;#STATE "roomname" 0;#IF ((@RoomDesc) AND (@RoomExits)) {#TAG name,descpara,exit {@RoomName} {@RoomDesc} {@RoomExits}};#VARIABLE RoomDesc %null;#VARIABLE RoomExits %null}}
#VAR InRoom {0}
#VAR RoomName {A Large Intersection}
#VAR RoomDesc {}
#VAR RoomExits {}
#TRIGGER "roomname" {^%e[1;33m(*)} {#VARIABLE InRoom 1} "" {color}
#COND {Obvious exits:} {#VARIABLE RoomName %stripansi( "%t1");#OK}
#COND {({North|South|East|West|Up|Down})%s- *} {#VARIABLE RoomExits %trim(%concat(@RoomExits," ",%1))} {manual}
#TRIGGER {<%d/%dhp %d/%dm %d/%dmv} {checkroom;#TAG prompt} "" {nocr|prompt}
#TRIGGER {%e[1;35m(*)} {#IF (@InRoom) {#IF (@RoomDesc) {#VARIABLE RoomDesc %concat(@RoomDesc,%crlf,%stripansi("%1"))} {#VARIABLE RoomDesc %stripansi("%1")}}} "" {color}
#TRIGGER {*} {#NOMAP}
#TRIGGER {Alas, you cannot go that way...} {#NODIR}
#TRIGGER {You are too exhausted.} {#NODIR}
#TRIGGER {You need a boat to go there.} {#NODIR}
#TRIGGER {Only Avatars may enter this sanctum.} {#NODIR}
#TRIGGER {A strange force blocks your way.} {#NODIR}
#TRIGGER {The (%w) seem? to be closed.} {#DOOR %lastdir( ) %1;#NODIR}
#CLASS 0


This has pretty much worked %99 of the time for me. I mapped 3 zones with damn near flawless results.
_________________
Carabas
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Wed Aug 17, 2005 1:35 am   
 
Well Vijilante's changes seem to work almost perfect, the names and desc are right but it fails to map the exits. Carabas, your script you posted with the changes seems to do the same thing your original did, create blank rooms.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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