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
WDog
Newbie


Joined: 01 Sep 2003
Posts: 5
Location: Australia

PostPosted: Sun Sep 21, 2003 6:26 am   

Compass & Exits for RoD
 
This is my first script and would appreciate any comments.

I originally based on this on meqamoq75 Compass script. Then I tried to incorporate Santels Door mapper code. I could not get Santels code to work initially so I extensively changed it to my version.

The compass buttons in each direction are enabled depending on the 'Exits' string captured by the Exit trigger. I tried to use the mapper exits but its about half a second behind the room movement so using the compass for fast moving was not suitable.

Also when fastwalkalking the code would sometimes freeze the screen for 2 to 5 seconds. Possibly because I was generating '#alarm +.5 dobtnexits' on each move and they could all fire off at once.



#CLASS {Mapping}
#ALIAS PushMapLock {#VARIABLE MaplockStatus %maplocked _nodef {Mapping};#IF @MaplockStatus {#CALL %maplocked( 0)}}
#ALIAS PopMapLock {#CALL %maplocked( @MaplockStatus)}
#VAR MapLockStatus {1}
#CLASS 0

#CLASS {Mapping|Compass}
#ALIAS _aBDir {#ADDKEY BtnDirsdb %1 btn%2;#SHOWDB @BtnDirsdb}
#ALIAS _dBDir {#DELKEY BtnDirsdb %1;#SHOWDB @BtnDirsdb}
#ALIAS CompassExits {#LOOPDB @BtnDirsdb {#CALL %btnenable( %val, %ismember( %key, %1))};#NOOP}
#ALIAS _FixBDir {#IF %null( %-1) {#VARIABLE Temp @BtnDirsdb} {#VARIABLE Temp %-1};#VARIABLE BtnDirsdb %null;#FORALL @temp {#ADDKEY BtnDirsdb {%i}}}
#VAR BtnDirsdb {northbtnnsouthbtnseastbtnewestbtnwnorthwestbtnnwnortheastbtnnesoutheastbtnsesouthwestbtnswupbtnudownbtnd}
#BUTTON 61 {} {nw} {} {} {} {} {ARROWSE} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore} {nw} {btnnw} {4}
#BUTTON 62 {} {w} {} {} {} {} {ARROWL} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore|Stack} {west} {btnw} {4}
#BUTTON 63 {} {sw} {} {} {} {} {ARROWSW} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore|Stack} {sw} {btnsw} {4}
#BUTTON 64 {} {n} {} {} {} {} {ARROWU} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore} {north} {btnn} {4}
#BUTTON 65 {} {#IF %null( %look) {look} {%look}} {} {} {} {} {TARGET} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore|Stack} {look} {btnlook} {4}
#BUTTON 66 {} {s} {} {} {} {} {ARROWD} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore|Stack} {south} {btns} {4}
#BUTTON 67 {} {ne} {} {} {} {} {ARROWSW} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore} {ne} {btnne} {4}
#BUTTON 68 {} {e} {} {} {} {} {ARROWR} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore|Stack} {east} {btne} {4}
#BUTTON 69 {} {se} {} {} {} {} {ARROWNW} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore|Stack} {se} {btnse} {4}
#BUTTON 70 {} {u} {} {} {} {} {DIRN} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore} {up} {btnu} {4}
#BUTTON 71 {} {d} {} {} {} {} {DIRS} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore|Stack} {down} {btnd} {4}
#BUTTON 72 {} {PushMapLock;#LOOK %look;PopMapLock} {} {} {} {} {DOWNLOAD} {Size} {23} {23} {} {} {} {} {} {} {} "" {Explore|Stack} {Map Room} {btnMap} {4}
#BUTTON 79 {} {} {} {} {} {} {} {Size} {2} {65} {} {} {} {} {} {Separ} {} "" {Inset} {} {} {4}
#CLASS 0

#CLASS {Mapping|RoomExits}
#ALIAS _aDDir {#ADDKEY AddDoorDirsdb %1 %2;#SHOWDB @AddDoorDirsdb}
#ALIAS _dDDir {#DELKEY AddDoorDirsdb %1;#SHOWDB @AddDoorDirsdb}
#ALIAS _FixDDir {#IF %null( %-1) {#VARIABLE Temp @AddDoorDirsdb} {#VARIABLE Temp %-1};#VARIABLE AddDoorDirsdb %null;#FORALL @temp {#ADDKEY AddDoorDirsdb {%i}}}
#VAR AddDoorDirsdb {northnsouthseastewestwnorthwestnwnortheastnesoutheastsesouthwestswupudownd} {}
#VAR ExitDirStr {north|south|east|west|down}
#VAR DoorDirStr {}
#TRIGGER {^Exits: (*)$} {#VARIABLE ExitDirStr %subchar( %lower( "%1"), "[] ,", "\|") _nodef {Mapping|RoomExits};#IF !%maplocked {#VARIABLE DoorDirStr %null _nodef {Mapping|RoomExits};#FORALL @ExitDirStr {#IF %iskey( @AddDoorDirsdb, %i) {#ADDITEM DoorDirStr %db( @AddDoorDirsdb, %i)}};#IF !%null( @DoorDirStr) {#ALARM {+0.5} {#FORALL @DoorDirStr {#DOOR %i}}}};CompassExits %subchar( @ExitDirStr, "", "")}
#CLASS 0



You can get it from http://www.users.bigpond.net.au/wdog/Compass%20and%20Room%20Exits.TXT
as infomation in the database record is lost here on the forum.

I play Realms of Despair and the exit string is in the format
Exits: north south [east] down
where the exits enclosed in [] are doors.

You need to change the #TRIGGER {^Exits: (*)$} to suit your mud. If your mud uses [] for doors you need to turn off "use [] for expansion" in Zmud prefrences. You may also need to change the line in the exit trigger#VARIABLE ExitDirStr %subchar( %lower( "%1"), "[] ,", "\|") _nodef {Mapping|RoomExits} to suit the exit line of the mud.

I use "/" as a test character for doors replacing "[]"

Variable AddDoorDirsdb contains the door dir where the key is the door name including test character. Alias _aDDir and _aDDir adds and deletes elements of the AddDoorDirsdb if you cant edit the var directly.

Variable BtnDirsdb contains the compass Buttons ID where the key is the direction returned by the mud. Alias _aBDir and _aBDir adds and deletes elements of the BtnDirsdb

Finally when copying via the clipboard the Database Variables turn into string lists so _FixDDir and _FixBDir will repair that.
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Sat Sep 27, 2003 12:25 am   
 
I live to learn, Thank you I had forgot about the closed doors.
I look forward to tring your script, good job Smile
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