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
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Jan 09, 2005 6:44 pm   

Map mode override
 
Recently an IMM on a mud asked about mapping his mud (cities.of.glory.eu.org:7000). He was having problems getting the autoconfigure to produce a proper configuration. He also wanted to be able to automatically map out the mud. So I checked into it and found that the autoconfigure was having a problem because of the way the descriptions were designed. Some are extremely long like the example below, others quite short. At first I tried to use #TAG in my script to properly set and capture the data, but the consistency acheived was not 100%. So the final solution, override map mode entirely. In fact the script does not even want the mapper to be in map mode and will set it back to follow.

The script below includes only the room detection and mapping. It does not include the automatic walker. This script interracts heavily with zMapper. It is required for the proper operation of the script. This was also designed and tested for an IMM character that has vNums displayed on the same line as the room name. vNums are used for tracking location of steps. If you do not have them displayed larger modifications will be required to the RoomParse alias. I am not about to make and test these modifications for anyone. The script is provided as is.

Among the first things to change before attempting to use this script are some of your preferences.
In the Script Parser section:
Turn on "Wildcards in {} triggers" needed for 'goto %d' in oninput trigger.
Turn off "Allow [] for eval" when on it corrupts room data.
Turn off "Allow <> for expand" when on data corruption is possible.

Next to do is turn off a few things in the mapper configuration.
In the Strings and Doors section:
Empty both command strings for doors and locked doors. The script handles the sending and timing of these commands.

Code:
#CLASS {RoomCapture}
#ALIAS RoomParse {#T- AwaitingStep;#NOOP %regex(@RoomData,"((?:\|>) .*)*\|> (.*)\|(?:| )\[ Exits\:(?:( None! )|[newsud ]+)\]",,RoomLines);#DELITEM RoomLines {};#IF (%item(@RoomLines,1)=%item(@DirQueue,1)) {#DELNITEM RoomLines 1};RoomVnum=-1;RoomName=%pop(RoomLines);#IF (%regex(@RoomName,"\[\s*(\d+)\] (.*) \[(.*)\] \[(.*)\]",RoomVnum,RoomName,RoomFlags,RoomType)=0) {RoomName=%pop(RoomLines);#IF (%regex(@RoomName,"\[\s*(\d+)\] (.*) \[(.*)\] \[(.*)\]",RoomVnum,RoomName,RoomFlags,RoomType)=0) {RoomName=%pop(RoomLines);#IF (%regex(@RoomName,"\[\s*(\d+)\] (.*) \[(.*)\] \[(.*)\]",RoomVnum,RoomName,RoomFlags,RoomType)=0) {RoomName=%pop(RoomLines);#IF (%regex(@RoomName,"\[\s*(\d+)\] (.*) \[(.*)\] \[(.*)\]",RoomVnum,RoomName,RoomFlags,RoomType)=0) {RoomName=%pop(RoomLines);#NOOP %regex(@RoomName,"\[\s*(\d+)\] (.*) \[(.*)\] \[(.*)\]",RoomVnum,RoomName,RoomFlags,RoomType)}}}};#IF (@RoomVnum=-1) {#ECHO Error finding roomname line!! Sending look.;#SEND look;#T+ AwaitingStep;#STATE RoomCap 1} {RoomDesc=%replace(@RoomLines,"|",%crlf);RoomExit=%subchar(%word(%line,2,":")," ]","|");#IF (@RoomExit="None!") {RoomExit=""};#DELITEM RoomExit {};#IF (%word(@DirQueue,1)="goto") {#TELEPORT @RoomVnum} {#IF (%item(@DirQueue,1)!="look") {#IF (@LinkedRoom=%roomkey(@RoomVnum)) {#TELEPORT @RoomVnum;#IF (%roomload) {onroomcreate}} {RoomX=%map.CurRoom.X;RoomY=%map.CurRoom.Y;RoomZ=%map.CurRoom.Z;CalcNewRoomLoc;PossibleRoom=%mapquery(%concat("([X]=",@NewX,") AND ([Y]=",@NewY,") AND ([Z]=",@NewZ,") AND ([ZoneID]=",%zonenum,")"));#IF (%roomnum(@RoomVnum)) {#IF (%roomlink(@RoomVnum,@ReverseDir)>-1) {#ECHO Maze detected!;SetOneWay %roomkey(@RoomPrev) %roomkey(@RoomVnum) @zMapDirType(%item(@DirQueue,1)) @zMapDirType(@ReverseDir);#TELEPORT @RoomVnum} {#IF (%roomlink(@RoomVnum,@ReverseDir)=-1) {SetOneWay %roomkey(@RoomPrev) %roomkey(@RoomVnum) @zMapDirType(%item(@DirQueue,1)) @zMapDirType(@ReverseDir);#TELEPORT @RoomVnum} {#NOOP %roomlink(,%item(@DirQueue,1),@RoomVnum);#TELEPORT @RoomVnum}}} {#IF (@LinkedRoom=-2) {#IF (%eval((@RoomVnum/100))!=%eval(%roomnum/100)) {#ECHO Zone change};#IF (@PossibleRoom) {#NOOP %roommode(1);#IF (%roomlink(@PossibleRoom,@ReverseDir)=-2) {#IF (%roomnum(@PossibleRoom)=@RoomVnum) {#NOOP %roomlink(,%item(@DirQueue),@PossibleRoom);#TELEPORT @PossibleRoom;PossibleRoom=""}};#IF (@PossibleRoom) {#ADD NewX 24;#ADD NewY 24;#VAR PossibleRoom {%map.NewRoom("","",@NewX,@NewY,@NewZ,0,-1)};#NOOP %roomlink(,%item(@DirQueue,1),@PossibleRoom);#TELEPORT @PossibleRoom;onroomcreate};#NOOP %roommode(0)} {#MAKEROOM %item(@DirQueue,1);onroomcreate}}} {#TELEPORT @RoomVnum;#IF (%roomload) {onroomcreate}}}} {onroomcreate}};#DELNITEM DirQueue 1;#IF (%numitems(@DirQueue)) {#IF (%match(%item(@DirQueue,1),"%t")) {LinkedRoom=%roomlink(@RoomVnum,%item(@DirQueue,1));ReverseDir=%reversedir(%item(@DirQueue,1));RoomPrev=@RoomVNum};#STATE RoomCap 1} {#STATE RoomCap 0;#T- RoomCap;#SAVE}}}
#ALIAS SetOneWay {#NOOP sourceRoom destRoom sourceDir destDir;#VAR ComTemp {%map.GetRoom(%1)};#CALL @ComTemp.SetLink(%2,%3,%4,"",1);#CALL @ComTemp.SetLink(%2,%3,%4,"",1);#CALL @ComTemp.Save;#VAR ComTemp {}}
#ALIAS onroomcreate {#NOOP %maplocked(0);#NOOP %roomnum(,@RoomVnum) %roomnote(,@RoomFlags @RoomType);#NOOP %roomname(,@RoomName) %roomdesc(,@RoomDesc);#FORALL @RoomExit {#IF (%roomlink(,%i)=-1) {#IF ("%i"=@ReverseDir) {#NOOP %roomlink(,%i,@RoomPrev)} {#NOOP %roomlink(,%i,-2)}}};#FORALL %roomexit {#IF (%ismember("%i",@RoomExit)=0) {#IF (%roomlink(,%i)!=-2) {#VAR PossibleRoom {%map.GetRoom(%roomlink(,%i))};#IF (@PossibleRoom.ExitDir(@zMapDirType(%reversedir(%i))).KindId=0) {SetOneWay %roomlink(,%i) %roomkey(@RoomVnum) @zMapDirType(%reversedir(%i)) @zMapDirType(%i)};#VAR PossibleRoom {}} {#VAR PossibleRoom {%map.GetRoom(%roomkey)};#IF (@PossibleRoom.ExitDir(@zMapDirType(%i)).KindId=0) {#NOOP %roomlink(,%i,-1)};#VAR PossibleRoom {}}}};#NOOP %roomload(,0)}
#ALIAS CalcNewRoomLoc {NewY=@RoomY;NewX=@RoomX;NewZ=@RoomZ;#IF (%item(@DirQueue,1)="n") {NewY=%eval(@RoomY-240)} {#IF (%item(@DirQueue,1)="s") {NewY=%eval(@RoomY+240)} {#IF (%item(@DirQueue,1)="w") {NewX=%eval(@RoomX-240)} {#IF (%item(@DirQueue,1)="e") {NewX=%eval(@RoomX+240)} {#IF (%item(@DirQueue,1)="u") {NewZ=%eval(@RoomZ+1)} {#IF (%item(@DirQueue,1)="d") {NewZ=%eval(@RoomZ-1)}}}}}}}
#ONINPUT "DirCap" {^({n|north|e|east|s|south|w|west|u|up|d|down|look|goto %d})$} {#IF (%trigger(AutoMapper)) {#MENU {Mapper|File|Follow Mode}};#NOOP %maplocked(0);#IF (%ismember("%1","north|south|east|west|up|down")) {DirQueue=%additem(%left("%1",1),@DirQueue)} {DirQueue=%additem("%1",@DirQueue)};#IF (%numitems(@DirQueue)=1) {RoomData="";#IF (%ismember("%1","n|north|e|east|s|south|w|west|u|up|d|down")) {LinkedRoom=%roomlink(,"%1");ReverseDir=%reversedir("%1");RoomPrev=@RoomVNum;#IF (@LinkedRoom!=-1) {#VAR NewX {%map.GetRoom(%roomkey)};#VAR ComTemp {@NewX.ExitDir(@zMapDirType(%item(@DirQueue,1)))};#VAR NewX {};#IF (@ComTemp.KindID!=0) {#IF (%ismember("%1",@RoomExit)=0) {#IF (@ComTemp.KindID=2) {#IF (%doorname(,%1)="") {#SUB {unlock door %1}} {#SUB {unlock %word(%doorname(,%1),1) %1}};#T+ DoorUnlocked} {#IF (%doorname(,%1)="") {#SUB {open door %1}} {#SUB {open %word(%doorname(,%1),1) %1}};#T+ DoorOpened}}};#VAR ComTemp {}} {LinkedRoom=-2}}};#T+ AwaitingStep;#IF (%trigger(RoomCap)=0) {#T+ RoomCap;#STATE RoomCap 1}}
#STAT {[@RoomVnum] @RoomName [@RoomFlags] [@RoomType] Queue:@DirQueue}
#FUNC zMapDirType {%eval(%ismember(%upper(%1),"N|NE|E|SE|S|SW|W|NW|U|D")-1)}
#FUNC zMapDirTypeL {%eval(%ismember(%upper(%1),"NORTH|NORTHEAST|EAST|SOUTHEAST|SOUTH|SOUTHWEST|WEST|NORTHWEST|UP|DOWN")-1)}
#CLASS 0

#CLASS {RoomCapture|AwaitingStep}
#TRIGGER "DoorUnlocked" {^{> |}~*Click~*$} {#IF (%doorname(,%item(@DirQueue,1))="") {open door %item(@DirQueue,1)} {open %word(%doorname(,%item(@DirQueue,1)),1) %item(@DirQueue,1)};#T+ DoorOpened;#T- DoorUnlocked} "" {disable}
#TRIGGER "DoorOpened" {^{> |}{Okay.|But it's currently open!}$} {#SEND {%item(@DirQueue,1)};#T- DoorOpened} "" {case|disable}
#TRIGGER {^{> |}The (*) seems to be closed.$} {#IF (%roomlink(,%item(@DirQueue,1))!=-1) {#VAR NewX {%map.GetRoom(%roomkey)};#VAR ComTemp {@NewX.ExitDir(@zMapDirType(%item(@DirQueue,1)))};#IF (@ComTemp.KindID=0) {ComTemp.KindID=1;ComTemp.DoorName="%1";#CALL @ComTemp.Save};#VAR NewX {};#VAR ComTemp {}} {#DOOR %item(@DirQueue,1) {%1}};open %1 %item(@DirQueue,1);#T+ DoorOpened}
#TRIGGER "RoomCap" {RoomCap} {} "" {manual|disable}
#COND {} {RoomData=%concat(@RoomData,"|",%line);PossibleRoom=%pos("[ Exits:",%line);#IF (@PossibleRoom) {#IF (%ends(%line,"]")) {RoomData=%insert("|",@RoomData,%pos("[ Exits:",@RoomData));#STATE RoomCap 3;#SET RoomCap 3 1}}} {looplines|param=99|disable}
#COND {*} {#ECHO Error in capturing RoomData, 99 lines exceeded;#STATE RoomCap 0;#T- RoomCap} {disable}
#COND {} {RoomParse} {manual|disable}
#TRIGGER {^{> |}Alas, you cannot go that way...$} {#DELNITEM DirQueue 1;#IF (%numitems(@DirQueue)) {#IF (%match(%item(@DirQueue,1),"%t")) {LinkedRoom=%roomlink(@RoomVnum,%item(@DirQueue,1));ReverseDir=%reversedir(%item(@DirQueue,1));RoomPrev=@RoomVNum};#STATE RoomCap 1} {#STATE RoomCap 0;#T- RoomCap;#SAVE}}
#TRIGGER {^{> |}There doesn't seem to be a (%w) here.$} {#T- DoorOpened;#ECHO Error with door naming or existence to the %item(@DirQueue,1);#DELNITEM DirQueue 1;#IF (%numitems(@DirQueue)) {#IF (%match(%item(@DirQueue,1),"%t")) {LinkedRoom=%roomlink(@RoomVnum,%item(@DirQueue,1));ReverseDir=%reversedir(%item(@DirQueue,1));RoomPrev=@RoomVNum};#STATE RoomCap 1} {#STATE RoomCap 0;#T- RoomCap;#SAVE}}
#TRIGGER {^{> |}That's private property -- no trespassing!$} {#VAR NewX {%map.GetRoom(%roomkey)};#VAR ComTemp {@NewX.ExitDir(@zMapDirType(%item(@DirQueue,1)))};#VAR NewX {};#VAR ComTemp.LabelStr {%concat("Private-",%item(@DirQueue,1))};#VAR ComTemp.Dir {11};#CALL @ComTemp.Save;#VAR ComTemp {};#NOOP %roomlink(,%item(@DirQueue,1),-1);#DELNITEM DirQueue 1;#IF (%numitems(@DirQueue)) {#IF (%match(%item(@DirQueue,1),"%t")) {LinkedRoom=%roomlink(@RoomVnum,%item(@DirQueue,1));ReverseDir=%reversedir(%item(@DirQueue,1));RoomPrev=@RoomVNum};#STATE RoomCap 1} {#STATE RoomCap 0;#T- RoomCap;#SAVE}}
#TRIGGER {^{> |}No room exists with that number.$} {#IF (%word(@DirQueue,1)="goto") {#DELNITEM DirQueue 1;#IF (%numitems(@DirQueue)) {#IF (%match(%item(@DirQueue,1),"%t")) {LinkedRoom=%roomlink(@RoomVnum,%item(@DirQueue,1));ReverseDir=%reversedir(%item(@DirQueue,1));RoomPrev=@RoomVNum};#STATE RoomCap 1} {#STATE RoomCap 0;#T- RoomCap;#SAVE}}} "" {case}
#TRIGGER {^{> |}Tho art not of noble blood and pure of Heart. Tho fail to withstand the test.$} {#DELNITEM DirQueue 1;#IF (%numitems(@DirQueue)) {#IF (%match(%item(@DirQueue,1),"%t")) {LinkedRoom=%roomlink(@RoomVnum,%item(@DirQueue,1));ReverseDir=%reversedir(%item(@DirQueue,1));RoomPrev=@RoomVNum};#STATE RoomCap 1} {#STATE RoomCap 0;#T- RoomCap;#SAVE}}
#TRIGGER {^{> |}It seems to be locked.$} {#IF (%roomlink(,%item(@DirQueue,1))=-1) {#NOOP %roomlink(,%item(@DirQueue,1),-2)};#VAR NewX {%map.GetRoom(%roomkey)};#VAR ComTemp {@NewX.ExitDir(@zMapDirType(%item(@DirQueue,1)))};ComTemp.KindID=2;#CALL @ComTemp.Save;#VAR NewX {};#VAR ComTemp {};#IF (%doorname(,%item(@DirQueue,1))="") {unlock door %item(@DirQueue,1)} {unlock %word(%doorname(,%item(@DirQueue,1)),1) %item(@DirQueue,1)};#T+ DoorUnlocked}
#CLASS 0

#CLASS {RoomCapture|RoomCapVars}
#VAR DirQueue {} {}
#VAR RoomData {} {}
#VAR RoomLines {} {}
#VAR RoomName {%roomname} {%roomname}
#VAR RoomDesc {} {}
#VAR RoomExit {} {}
#VAR RoomVnum {%roomnum} {%roomnum}
#VAR RoomFlags {%roomnote} {%roomnote}
#VAR RoomType {} {}
#VAR RoomPrev {} {}
#VAR ReverseDir {} {}
#VAR RoomX {} {}
#VAR RoomY {} {}
#VAR RoomZ {} {}
#VAR NewX {} {}
#VAR NewY {} {}
#VAR NewZ {} {}
#VAR PossibleRoom {} {}
#VAR LinkedRoom {} {}
#VAR ComTemp {}
#CLASS 0


Example room:
Code:
 625hp 100m 187mv [$6176] [273033030 XPtoLVL] [Vijilante 97%]
> goto 35001
[35001] Welcome to Cities of Glory [ !MOB INDOORS PEACEFUL SAFE CAMP ] [ Inside]
Basic commands to make playing easier:
>autoexit    >display all     >autoloot     >autosac

If you have never played before then you are most likely using a TELNET terminal
there is a much better way to play. Point your internet browser to the following
address  -->  www.mudlists.com/mud/cities_of_glory/mudclient.zip    and run the
executable.
     
Gaining levels and practicing skills are done in your class guilds.  They are
located throughout Midgaard.  The mobs in this city are very easy to kill so you
should be able to explore the immediate area with little fear of being killed.

The equipment that you are wearing is currently the best equipment in the game
for you.  The next set of eq that you would want to try to achieve can be
purchased from the armory in Midgaard.  Then the following set is available
in the Armory in the town called The Shire. (South and west from Midgaard)

You are currently located on a small island that we call Newbie Island.  There
are thousands of rooms here just for you. Feel free to adventure out with little
risk.  Once you achieve around level 20, you will want to be leaving the island
for more adventures.  (If you die, you get free corpse retreaval from mortician.)

Reading the following help files will help you understand our gaming environment better.

help newbie     - to get a list of helpful files for newbies.
Help zone info      - to get current info on our zones.
help <help>       - to get information how help works



[ Exits: d ]

 625hp 100m 187mv [$6176] [273033030 XPtoLVL] [Vijilante 97%]
>


What it does not do:
Automatically detect doors in the exit line. The mud just doesn't show them. They are detected and set if you bump into them though.

Edit: added in "#T+ AwaitingStep" in the automatic look resend. 1/10@6:12A eastern
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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