Fast walk for a Mud script - 06/05/07 04:38 PM
Been trying to write a fast walk for my Mud client script, but messed up quite badly. I want to use the default method of one string to display multipul direction inputs like: 2n4w6e(twice north, 4 times west and 6 times east) or 2n2d2n(twice north, twice down and twice north), but my script doesn't seem to do that at all, but works for single inputs. How can I mod it so it can take multipul directions(like say 2n5e2n6e) and make it work in sequence it is typed?
(using echo instead of sockwrite until I can get it to work...)
Code:
;=========== ; Fast Walk ;=========== alias fw { ;Retreaving Information ;---------------------- %direct = $1 ;North ;----- %north = $wildtok(%direct, *n, 1, 32) if (%findn != $null) { %north = $gettok(%direct,%findn) } if (($len(%north) > 1) && (%north != $null)) { %nnum = $abs(%north) } if (($len(%north) = 1) && (%north != $null)) { %nnum = 1 } echo 4 %north ;East ;---- %east = $wildtok(%direct, *e, 1, 32) if (($len(%east) > 1) && (%east != $null)) { %enum = $abs(%east) } if (($len(%east) = 1) && (%east != $null)) { %enum = 1 } ;South ;----- %south = $wildtok(%direct, *s, 1, 32) if (($len(%south) > 1) && (%south != $null)) { %snum = $abs(%south) } if (($len(%south) = 1) && (%south != $null)) { %snum = 1 } ;West ;---- %west = $wildtok(%direct, *w, 1, 32) if (($len(%west) > 1) && (%west != $null)) { %wnum = $abs(%west) } if (($len(%west) = 1) && (%west != $null)) { %wnum = 1 } ;Processing Information ;---------------------- if (%north != $null) { %fwi = %nnum %fdo = $remove(%north,%nnum) while %fwi > 0 { echo 4 %fdo dec %fwi } } if (%east != $null) { %fwi = %enum %fdo = $remove(%east,%enum) while %fwi > 0 { echo 4 %fdo dec %fwi } } if (%south != $null) { %fwi = %snum %fdo = $remove(%south,%snum) while %fwi > 0 { echo 4 %fdo dec %fwi } } if (%west != $null) { %fwi = %wnum %fdo = $remove(%west,%wnum) while %fwi > 0 { echo 4 %fdo dec %fwi } } unset %north %east %south %west unset %nnum %enum %snum %wnum }
(using echo instead of sockwrite until I can get it to work...)