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
Hibio
Beginner


Joined: 19 Mar 2004
Posts: 22

PostPosted: Tue Mar 30, 2004 10:21 pm   

Alias "goto" for zMud 5.5+
 
Created for Overdrive mud, but I am sure you can use it on another mud with some modifications if necessary.

Here is something cool. Enjoy and have fun.
Here is a formated version so you can read easier.
You will have to have the "directions" setup first using variables to set the direction before using this cool alias.

--------------------------------------------------------------
#alias goto
{
#if (@%1 & (%lower( %1) != @location)) {
#var locold @locnew
#var locoldb @locnewb
} {
#echo DIRECTION DOES NOT EXIST!!!
#abort 1
}
gotoexpand %1 locnew
#var locvartemp @{%insert( "b", %1, %len( %1+1))}
gotoexpand locvartemp locnewb
gotofindpos locold locnew
gotonew @pos locoldb locnew
#var location %1
}

#alias gotoexpand
{
#var loctemp {}
#forall @%1 {
#if (%isnumber( %i)) {#var goexnum %i} {
#var goexmov %i
#loop @goexnum {#var loctemp {%additem( %lower( @goexmov), @loctemp)}}
#var goexnum 1
}
}
#if (%2) {#var %2 @loctemp} {#echo ~%2 doesn't exist.}
}

#alias gotofindpos
{
#var pos 1
#while ((%item( @%1, @pos) = %item( @%2, @pos)) & ((@pos < %numitems( @%1)) & @pos < %numitems( @%2))) {#add pos 1}
}

#alias gotonew
{
#loop {1,%numitems( @%2)-%1+1} {%item( @%2, %i)}
#loop {%1,%numitems( @%3)} {%item( @%3, %i)}
}

#alias gotoback
{
#if (@%1 & (%lower( %1) != @location)) {
#var locold @locnew
#var locoldb @locnewb
} {
#echo DIRECTION DOES NOT EXIST!!!
#abort 1
}
gotoexpand %1 locnew
#var locvartemp @{%insert( "b", %1, %len( %1+1))}
gotoexpand locvartemp locnewb
gotofindpos locold locnew
gotonew @pos locoldb locnew
#var location %1
}

#VAR gotomove {w} {_nodef} "GOTO"
#VAR gotonum {1} {_nodef} "GOTO"
#VAR cath {{}} {{}} "GOTO"
#VAR cathb {{}} {{}} "GOTO"
#VAR locnew {} {@} "GOTO"
#VAR goexnum {1} {_nodef} "GOTO"
#VAR goexmov {} {_nodef} "GOTO"
#VAR locold {} {{}} "GOTO"
#VAR pos {1} {_nodef} "GOTO"
#VAR loctemp {} {{}} "GOTO"
#VAR locnewb {} {{}} "GOTO"
#VAR locoldb {} {_nodef} "GOTO"
#VAR locvartemp {} {_nodef} "GOTO"
#VAR temp {} {_nodef} "GOTO"

-------------------------------------------------------------------

Normally in Overdive mud, the default(center) location would be "cath" for the Cathedral on that mud.

Here are some direction samples:

#VAR courtyard {4|w|2|s|w} {_nodef}
#VAR courtyardb {e|2|n|4|e} {_nodef}
#VAR frobs {3|w|3|n|2|w|n} {_nodef}
#VAR frobsb {2|s|2|e|3|s|3|e} {_nodef}

Starting from the Cathedral, you enter "goto frob", it would take you to frob, then you can enter "goto courtyard", it would then take you from the frob spot to the courtyard without having to type in "goto cath" where it would take you back to the default location first. Not only that, you see that the directions do share some comment movements in the beginning where both have at least 3 west, with this "goto" it will check for it and when you go from frob to couryard, it would take you from the frob position to the last known comment location then proceed forward to the new location that you defined.

Overall, this is basically almost like the zmud mapper, but this is in text format and only go through defined directions.

Good luck..
Reply with quote
Hibio
Beginner


Joined: 19 Mar 2004
Posts: 22

PostPosted: Tue Mar 30, 2004 10:27 pm   
 
Oh also, here is the alias to reset to the default location which is the Cathedral on Overdrive mud.

#alias gotoreset
{
#var location cath
#var locnew {}
#var locnewb {}
#var locold {}
#var locoldb {}
}

and to set a new location when you mess up or when you walked toward that location and need to let it know you are travelling from a new location that you defined in your directions.

#alias gotoset
{
#if (@%1) {} {
#echo DIRECTION DOES NOT EXIST!!!
#abort 1
}
gotoexpand %1 locnew
#var locvartemp @{%insert( "b", %1, %len( %1+1))}
gotoexpand locvartemp locnewb
#var location %1
#say GOTOSET -----> %1
}


hope you guys enjoy it...
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