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
CodeMaster Rapture
Newbie


Joined: 30 Jan 2004
Posts: 7
Location: USA

PostPosted: Sat Feb 25, 2006 9:22 pm   

zMUD Speedwalk parser? (***SOLVED***)
 
Hey all,

I play on a mud that has a built-in speedwalking system. It is much faster to use this than the zMUD flavor. So, I'm trying to come up with a simple alias to convert a zmud path into a speedwalking path the mud can understand.

Unfortunately, the speedwalking code on this mud is such that "4n3e2s" would have to be converted to "nnnneeess". Any ideas on how to do this?

I've tried this while testing:

Code:

#alias {go} {
;Empty the variable
#var my_path ""

;Take the literal and lower-case all characters
@my_path = %literal( %lower( %0))

;Strip quotes
@my_path = %stripq(@my_path)

;Replace all characters with "" except: 1-9, nsewud
@my_path = %subchar( @my_path, " abcfghijklmopqrtvxyz!@#$%^&*()_-+={}[]()|\/?.>,<`~':;", "")

;Spit it out
#show {@my_path}
}


This works fine as a starting point, I just haven't figured out how to turn "3n2s4de" into "nnnssdddde". Also, I'd need to be able to add in some error checking to make sure i don't try to go over 30 times in one direction (122n is bad!).

Any suggestions?

Thanx,
-CMR
_________________
Don't run! You'll only die tired!

Last edited by CodeMaster Rapture on Sun Feb 26, 2006 4:02 am; edited 1 time in total
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sat Feb 25, 2006 10:08 pm   
 
I made scripts for doing that before with more complex checks, you can try searching the forums. Or something like this should work:
#ALIAS go {#SHOW %replace(%exec(%concat(".","%-1")),"|","")}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
CodeMaster Rapture
Newbie


Joined: 30 Jan 2004
Posts: 7
Location: USA

PostPosted: Sun Feb 26, 2006 3:52 am   
 
Well, I've gotten some headway due to your suggestion. Although I think I may have found a bug and/or limitation of zMUD 7.21 with built-in functions.

Here's a working alias:

Code:
//Empty the variable
#var my_path ""

//Take the literal and lower-case all characters
@my_path = %literal( %lower( %0))

//Strip quotes
@my_path = %stripq( @my_path)

//Remove all characters except: 1-9 and nsewud
@my_path = %subchar( @my_path, " abcfghijklmopqrtvxyz!@#$%^&*()_-+={}[]()|\/?.>,<`~':;", "")

//Expand directions and remove | symbol (3n -> nnn)
@my_path = %replace( %pathexpand( @my_path), "|", "")

//Spit it out
#show {@my_path}


Few tests:
Quote:
go 3n4u2see2d
nnnuuuusseedd

go 4u2sddd chat hi all oops 2sd;sleep
uuuussdddsssd
sleep


go 10n13e12d;go 12u13w10s
nnnnnnnnnneeeeeeeeeeeeedddddddddddd
uuuuuuuuuuuuwwwwwwwwwwwwwssssssssss


I tend to be the type of programmer who uses as few variables as I possibly can, so I tried to compress that alias into one line and remove the @my_path variable. Here's how I did it:

Code:
#show {%replace( %pathexpand( %subchar( %stripq( %literal( %lower( %0))), " abcfghijklmopqrtvxyz!@#$%^&*()_-+={}[]()|\/?.>,<`~':;", "")), "|", "")}


When I try this version, the %replace() and %pathexpand() functions don't fire. So my output is still compressed and the output is in quotes with the first characters being "we".

Example:
Quote:
go 3d4euddd2s
"we3d4euddd2s"

go fish 3n4d2se
"wes3n4d2se"


It's a little strange. Maybe it's a bug or a nested function call limit?

Sincerely,
-CMR
_________________
Don't run! You'll only die tired!
Reply with quote
CodeMaster Rapture
Newbie


Joined: 30 Jan 2004
Posts: 7
Location: USA

PostPosted: Sun Feb 26, 2006 4:02 am   
 
Well, I figured out what caused the problem. I still don't know why tho. The nested %literal added the "we" characters and the nested %stripq() prevented it from being expanded. Why is it the larger version of my alias worked with the same functions in it?

Thanx for your time,
-CMR
_________________
Don't run! You'll only die tired!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion 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