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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Wed Aug 17, 2005 4:52 pm   

Medievia AutoMapper Script
 
Reference: ansi trigger question

Medievia AutoMapper Script

This script is designed to aid in the mapping of Medievia. zMUD's AutoMapper will mostly map Medievia simply by using the configuration wizard. However, Medievia's output can complicate things for you. The problem is that players, mobiles, room objects and even blood are part of the same block of text as the description. This is an example:

Quote:
The City of Medievia - Castle Square
Heavy slabs of stone have been perfectly aligned to give a solid and even
surface for the citizens of this city. Rumor has it that all the traffic of the
world passes through this courtyard at one time or another, and this, the
center, is the best place to watch it. Never still, at any time of day or
night, the courtyard is a consistent bustle of activity. Standing in the shadow
of Castle Medievia, floating high above, posts bearing magically glowing globes
have been erected to bring light to the eternal dark. Stone steps lead upwards
to the castle far above, unsupported by anything physical yet sturdy enough to
take the weight of many travelers. To one side stands a simple stone arch,
unattached to anything but noticeable from the shimmering in the air within the
arch itself. A steady stream of people appear to be walking to this arch,
walking through and fading from view. Just as frequently, people solidify from
air on the other side, pausing and then going about their business. There is a
FAQ posted on a nearby wall that you should read. (Type LOOK FAQ)

Some drops of blood can be seen on the ground.
The corpse of a janitor lies here rotting.
A curiously forked twig has been dropped here.
(3) There is a bright ball of light on the ground here.
A large fountain is here gurgling out an endless stream of water.

A large bronze dragon peers at you, tearing at the ground with its claws.
He fades in and out of existence, moving location randomly.
(LEGEND)(HERO)Djax the Assassin Hero is here. (IT)
An adult silver dragon is resting here.
(HERO)Earl Dervel the Mage Hero is here.
An adult copper dragon is resting here.

He fades in and out of existence, moving location randomly.
(BLOOD)Baron Zaphod the Demon Slayer is resting here. (IT)
(LEGEND)(HERO)(MH)Niryk, the little girl of mop, is here.
Sidius the Godfather is here.

Note: Exact color representation was not possible due to the white background.

As you can probably imagine, the AutoMapper would detect that entire block of text as the room name and description without the help of a script.

The script I've written is probably not complete and may have some quirks, so consider this as "beta" quality and use at your own risk. With that said, I would appreciate anyone who would test this script and these instructions and report back to this thread.

Continued
_________________
Carabas

Last edited by Carabas on Fri Aug 26, 2005 7:40 pm; edited 12 times in total
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Wed Aug 17, 2005 4:53 pm   
 
The Script
Last Updated: Aug 24, 2005

Code:
#CLASS 0
#TRIGGER {<%d/%dhp %d/%dm %d/%dmv} {#IF (%defined(checkroom)) {checkroom};#IF (!@RoomLook) {#TAG prompt}} "" {nocr|prompt}

#CLASS {System|Automapper}
#TRIGGER {*} {#NOMAP}
#TRIGGER {The (%w) seem? to be closed.} {#DOOR %lastdir( ) %1;#NODIR}
#TRIGGER {You are too exhausted.} {#NODIR}
#TRIGGER {Alas, you cannot go that way...} {#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 {Your high level keeps you from entering.} {#NODIR}
#TRIGGER {Your low level keeps you from entering.} {#NODIR}
#CLASS 0

#CLASS {System|AutomapperAll} {enable}
#ALIAS checkroom {#IF (@InRoom) {#IF (@RoomExits) {#TAG name,descpara,exit {@RoomName} {@RoomDesc} {@RoomExits};#VAR RoomLook 0};#IF (!@RoomLook) {#VARIABLE InRoom 0;#STATE "roomname" 0;#VARIABLE RoomDesc %null;#VARIABLE RoomExits %null}}}
#ALIAS RoomLook {#VAR RoomLook 1;look;exits}
#VAR InRoom {0}
#VAR RoomName {Inside the Fountain of Stars}
#VAR RoomDesc {}
#VAR RoomExits {}
#VAR RoomLook {0}
#TRIGGER "roomname" {^%e[1;33m([%a%p'])%e[0m$} {#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 "roomdesc" {^%e[1;35m([%a%p'])%e[0m$} {#IF (@InRoom) {#IF (@RoomDesc) {#VARIABLE RoomDesc %concat(@RoomDesc,%crlf,%stripansi("%1"))} {#VARIABLE RoomDesc %stripansi("%1")}}} "" {color}
; Experimental! Not tested.
#TRIGGER {You collapse, totally out of breath!} {#ALARM +1 {#STEP}}
#TRIGGER {You have to stand up before you can do that.} {stand;#STEP}
#CLASS 0



Changes:

Aug 24, 2005
---------------
-Made changes to the Room Name and Description triggers. They should be fool proof now.
-Uncovered a bug with the %p and %q wild-cards. Neither matches an apostrophe. Until this is fixed, an apostrophe needs to be in the range.
_________________
Carabas

Last edited by Carabas on Fri Aug 26, 2005 7:04 pm; edited 5 times in total
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Wed Aug 17, 2005 4:53 pm   
 
Instructions

IMPORTANT: The first trigger listed is a generic prompt trigger. This trigger must match your prompt for this script to work.

Copy/Paste the script into a text file. Import the script via the Settings -> Import -> Script menu within zMUD, and then open the AutoMapper. If you have already completed the configuration wizard, you will need to reconfigure the AutoMapper because this script will completely change the way the mapper receives and parses the information. Once you have completed the configuration wizard, you need to change a few things.

In the AutoMapper window, click on the Config menu, select Configuration Settings and then highlight Strings and Doors on the lefthand side. Enter the following commands:

For the open command enter: open %2
For the unlock/open command enter: unlock %2 %1;open %2
For the look command enter: roomlook

That is all of the manual tweaking of the mapper configuration that is necessary.

Now is the time to make sure that the generic prompt trigger I provided matches your prompt. If it does not, you will need to change the pattern so that it does.

Optional Addon

I am providing a neat addon to the above script that will color your rooms as they are created according to PK type. The colors are white, yellow and red for LPK, NPK and CPK resepectively.

Code:
#CLASS 0
#TRIGGER {~[(%w)]~[&5] <%n/%nhp %n/%nm %n/%n} {#VAR RoomPK {%1};#IF (%defined( checkroom)) {checkroom};#IF (!@RoomLook) {#TAG prompt}} "" {nocr|prompt}
#VAR RoomPK {LPK}

#CLASS {System} {enable}
#ALIAS onroomcreate {#IF (@RoomPK = "LPK") {#NOOP %roomcol( ,white)};#IF (@RoomPK = "NPK") {#NOOP %roomcol( ,yellow)};#IF (@RoomPK = "CPK") {#NOOP %roomcol( ,red)}}
#CLASS 0


The first trigger is a prompt trigger that matches my own.

Quote:
[LPK][SLQVW] <789/789hp 273/273m 610/610mv 100br -r>


The onroomcreate alias is a special alias that is executed each time a room is created. Based on the value of the @RoomPK variable, it will change the color of the current room.
_________________
Carabas

Last edited by Carabas on Fri Aug 26, 2005 7:05 pm; edited 3 times in total
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Wed Aug 17, 2005 5:23 pm   
 
Reserved space just incase.
_________________
Carabas
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Wed Aug 17, 2005 6:43 pm   
 
Hrm, this completely escaped my attention.

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


Unless you changed the pattern of the default prompt trigger I provided, it will not match your prompt.

Use this prompt trigger with the above script.

Code:
#TRIGGER {<%nhp %nm %n%w %nbr} {#IF (%defined(checkroom)) {checkroom};#IF (!@RoomLook) {#TAG prompt}} "" {nocr|prompt}
_________________
Carabas
Reply with quote
talith
Novice


Joined: 03 Mar 2005
Posts: 31

PostPosted: Thu Aug 18, 2005 1:02 am   
 
Ok i feel like an idiot. I got it working now, after looking at your new prompt trigger it appears the one i wrote was messing it up, i put %d/%dbr even though br doesnt look the same way as the HP and mana. Sorry. Btw script seems to be working nice, and the new addon is rather nifty.
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Thu Aug 18, 2005 1:24 am   
 
Wonderful, and don't feel like an idiot! We all make mistakes. I am really glad it is working for you now.
_________________
Carabas
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Mon Aug 22, 2005 1:53 pm   
 
This is wonderful, working very well for me.

Just a suggestion how about making the room name detection look for a line that starts with yellow color code and ends with the reset code
with no color changes in between to handle the few instances where a line starts with yellow and then changes color (when an invised person/mob says something it starts with a yellow asterisk then switches to bold cyan e.g.)

Something along the lines of (doing this use regex, not sure how to go about in zmud trigger option)

#REGEX {^%e[1;33m([A-Za-z ',-]+)%e[0m%}

That can probably be worked a little better.


Then this is just one other thing I've been playing with for walking paths and Medievia Breath
Using the breath on your prompt to control the speedwalk

Check to see if we're %inwalk when we get a prompt
If %walkactive we check to see if breath is less then # (40? seems to work nice) if it is we #PAUSE
If not %walkactive and breath is greater then # (80? seems to work nice) we #STEP

I played around with this a few times and got it working nicely but every once in a long while it fails and Im not sure why
never fails if i have ruby boots on though :/ but there expensive to supply every char with :) so would be nice to get this working 100%

EDIT: Just a note about the breath trigger the command for this prompt almost certainly has to be wrapped in #PRIORITY{} to handle multiple prompts being sent in quick succesion , usually when there's lag I learned this with my bs reporter

Really nice script!

Cheers Jesse (Caebryn on med)
_________________
I love deadlines. I like the whooshing sound they make as they fly by.
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Mon Aug 22, 2005 4:08 pm   
 
I'll make the suggested change to the room trigger. I didn't do this because I don't use channel headers, so I don't have the *say problem.

I've also pondered using breath to control speedwalks, but using slow walking and this script (with at least c quickness) works great for me. I'll still look into it more when I get some more time this week.

Yep, #PRIORITY will probaby be needed, but the prompt trigger I provided was only a generic one. Certainly if you are doing lots of stuff with your prompt (ie variables, bs/mal reps, etc), #PRIORITY is almost necessary.

Thanks for your positive comments.
_________________
Carabas
Reply with quote
Daagar
Magician


Joined: 25 Oct 2000
Posts: 461
Location: USA

PostPosted: Sat Sep 24, 2005 1:52 am   
 
Works like a charm, thank you.
Reply with quote
tgrunwald
Newbie


Joined: 07 Apr 2010
Posts: 7

PostPosted: Wed Apr 07, 2010 12:38 am   
 
This is still giving me problems in that it is not capturing the room name when I run it with the Medievia Map on. Has anyone been able to get the mapper to work with that?
Reply with quote
meddlesome
Wanderer


Joined: 24 Aug 2012
Posts: 70

PostPosted: Mon Oct 01, 2012 11:58 am   
 
tgrunwald wrote:
This is still giving me problems in that it is not capturing the room name when I run it with the Medievia Map on. Has anyone been able to get the mapper to work with that?


This is my solution for dealing with the Room Names...

//This gets the Room name located at the bottom of the map boarder.
#TRIGGER {´(%*)Ã} {#VAR RoomName {%1};#TAG name {@RoomName}}

//This gets the Room name that is on a line by itself. It is an Ansi Trigger.
#TRIGGER {^%e[1;33m(%*)%e[0m$} {#IF (%ascii(%left(%1,1))>64) {#IF (%ascii(%left(%1,1))<123) {#IF (%ascii(%right(%1,%len(%1)-1))>64) {#IF (%ascii(%right(%1,%len(%1)-1))<123) {#VAR RoomName %1;#TAG name {@RoomName}}}}}}

If the RoomName starts or ends with anything other than an alpha char, then it is not a valid room name. By checking the first and last character against the 65 - 122 range of All Capital and Lower case alpha characters. This keeps it from grabbing any of the mapping text and trying to put that in for the room name.
_________________
Intel Core 2 Quad Q9450 @2.66GHz
MDAC 2.8 SP1 ON WINDOWS XP SP3
Msjet40.dll ver 4.0.9511.0 + Security Bulletin MS08-028
CMUD v237
Order number: **7829
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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