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
Samus
Novice


Joined: 01 Jan 2003
Posts: 32

PostPosted: Fri Mar 07, 2003 2:53 pm   

Remembering which direction
 
How would you do this. If I type e to go east and kill a mob. Is there a way it will remember that east when I type withdraw to flee from battle.
I would want to make the alias called withdraw. I would type this:

e
k mob
withdraw(and it sends to the mud flee e)

is there anyway to do that?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Mar 07, 2003 4:05 pm   
 
#ONINPUT {^(%t)$} {#VAR lastdir %1}

Now whenever you enter a direction, the variable @lastdir contains the most recent direction entered.

Kjata
Reply with quote
doomfyre
Apprentice


Joined: 03 Jan 2002
Posts: 152
Location: USA

PostPosted: Fri Mar 07, 2003 5:17 pm   
 
And the alias, after putting in what Kjata gave you:

#ALIAS withdraw {flee @lastdir}
Reply with quote
Samus
Novice


Joined: 01 Jan 2003
Posts: 32

PostPosted: Sat Mar 08, 2003 7:00 am   
 
It doesn't seem to be working. When I type withdraw it sends to the mud {flee} and not a direction
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Mar 08, 2003 7:59 am   
 
Debug it by watching the tracking trigger:

#ONINPUT {^(%t)$} {#VAR lastdir %1;#ECHO Lastdir @lastdir}

Does that echo the direction you travelled? Sounds like the
variable isn't being set.

Ton Diening
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Mar 08, 2003 11:50 am   
 
First, did you go in at least one direction after setting the script and before typing withdraw? If so, then your directions might not be set-up properly, try entering this into the command line:
.2n

and see if it sends "2n" to the mud or two "n"'s. If the former is true, then enter this into the command line:
#DIR ns "n|north" n
#DIR sn "s|south" s
#DIR ew "e|east" e
#DIR we "w|west" w
#DIR ud "u|up" u
#DIR du "d|down" d
#DIR hl "nw|northwest" nw
#DIR lh "se|southeast" se
#DIR jk "ne|northeast" ne
#DIR kj "sw|southwest" sw

Kjata
Reply with quote
Samus
Novice


Joined: 01 Jan 2003
Posts: 32

PostPosted: Sat Mar 08, 2003 9:26 pm   
 
Yeah, it doesn't set a variable. I also put the #DIR in and it still isn't working...Here is some more output of the mud I play.

Hp:614 Mv:373 Tnl:944west

And then it would be the same for north south east up and down.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Mar 09, 2003 1:36 am   
 
Try the short form instead of the whole direction (i.e. use "e", instead of "east").

Kjata
Reply with quote
Samus
Novice


Joined: 01 Jan 2003
Posts: 32

PostPosted: Sun Mar 09, 2003 2:13 am   
 
Okay, it works with just the e instead of east, but withdraw only works if you use the full name, east. And also I must of been thinking backwards because what I wanted it to do was do the reverse direction ie.
I type north
then fight and mob and type withdraw
zMUD then sends flee south

Is that at all possible?
Reply with quote
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: Sun Mar 09, 2003 6:53 am   
 
Possible, but the opposite of what you originally posted. You want to go back the way you came, not continue on in the same direction?

#var dirs {north|east|south|west|up|down}
#ONINPUT {(@dirs)$} {getnextdir %1}
#alias getnextdir {
#case (%ismember(%1, @dirs)) {
#var nextdir south} {
#var nextdir west} {
#var nextdir north} {
#var nextdir east} {
#var nextdir down} {
#var nextdir up} {
#echo default case in nextdir assignment}
}
#alias withdraw {flee @nextdir}


This will work when you type in the full name of the direction to move. Abbreviations will not fire the trigger.

--edit--
Sorry Samus, I didn't read your last post carefully enough to see you acknowledge the direction reversal error. I apologize for that first sentence, it was unwarrented.
--edit2-
When i edit a post compulsively, does it create some sort of spam that I don't see? If so I'll try to cut back.
--------

moon.icebound.net:9000
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