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


Joined: 08 Sep 2005
Posts: 4

PostPosted: Fri Sep 09, 2005 2:43 am   

Return after Follow
 
A {wolf|lion|hippo} flees to the (%w).
MOB does not matter direction


Ok. If a given mob flees to the south. I follow and kill it. What is the easiest way to return to my place of oragin before it fled? I have tried several options and they are bulky and don't work correctly. I think a variable call is the way to go, but, I would like to see if anyone else has ever tried this before.

Thank you.
Reply with quote
Theragil
Apprentice


Joined: 13 Feb 2004
Posts: 157
Location: USA

PostPosted: Sat Sep 10, 2005 1:17 pm   
 
Before you start following, do this:

iWaypoint = %roomnum( )

After you're done, do this:

#walk @iWaypoint

This assumes you have the mapper working, and allows you to find your way back to the original location even if the mob flees several times before you kill it.
Reply with quote
Theragil
Apprentice


Joined: 13 Feb 2004
Posts: 157
Location: USA

PostPosted: Sat Sep 10, 2005 1:24 pm   
 
If you don't have the mapper working, get it working! :D But if you can't or don't want to, here's another approach.

When you start hunting:

lHuntingSteps = ""

Each time you follow:

lHuntingSteps = %additem(%1,@lHuntingSteps)

And when you're done:

#loop %numitems(@lHuntingSteps),1 {#send %item(@lHuntingSteps,%i)}

If you need to safewalk, you'll need to convert that into a #slow command or something instead.
Reply with quote
tye
Beginner


Joined: 24 Feb 2005
Posts: 27

PostPosted: Sun Sep 11, 2005 4:51 pm   
 
I suspect the %additem section will need to be a little more complex. If I'm reading that correctly, following a mob n, then e, then s, will cause you to subsequently go s, then e, then n, which is not what you want at all. What you want is to go n, then w, then s.

Which means that when you follow 's', you want to put 'n' into the command list. This can likely be handled just by performing a string comparison before calling %additem.

However, I'd be inclined to stick with the Waypoint solution. The reason being, if the directions ever fail to map "properly" (i.e. north matches west, for instance), then the reverse path you build will be invalid. It's my experience that walking random paths on a mud is not the safest thing to do.
Reply with quote
Theragil
Apprentice


Joined: 13 Feb 2004
Posts: 157
Location: USA

PostPosted: Sun Sep 11, 2005 9:40 pm   
 
Oh yeah, oops, forgot to put the reverse-direction thing in there. I agree the waypoint approach is much preferable... just provided the other one for completeness. Or that was the idea but it seems I left a key step out!
Reply with quote
karamin
Newbie


Joined: 08 Sep 2005
Posts: 4

PostPosted: Thu Sep 15, 2005 9:29 pm   
 
Thanks I will learn more about the auto mapper :)


And I can get the HuntingSteps function to work I will post it here!
Reply with quote
sheetan
Beginner


Joined: 07 May 2007
Posts: 19

PostPosted: Fri Jun 22, 2007 12:36 pm   
 
Hi,

i know this forum is old...but i have a question similar to that posted here!...
Say i am following someone in the game, the syntax is: You follow your leader (%w).
I am trying to find out if there is a way where I can reverse the path after being done using a simple command....and another question is if i can add directions. Example: You follow your leader cave.

Since zMUD does not consider cave a normal direction, i want to know if there is a way where i can make the reverse path for "cave" to be "out", for example.

Thanks in advance
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jun 23, 2007 4:18 am   
 
You can do that, but it's not very practical or useful since there's not really any sort of standard when it comes to non-standard exits. Even in the same game (or worse, in the same area of the same game), the reverse of "cave" doesn't necessarily have to be "out". It really depends on what the area builder decided to use the moment it was created and what the QC people did to it if it needed to be changed (which is further dependant on the mood of the QC people).

To add a direction, use the #DIRECTION command.

#DIRECTION f|v {commands}
f = letter representing the forward-moving direction (cave)
v = letter defined for the f of the reverse direction command
commands = zscript functions and game commands to execute, can be as complex as you know how to make it (%prompt(), %pick(), practically any %function() or @function() will work, but like a function you can't use #commands in it)

Now, as far as "commands" goes, in the GUI there's a character limit. I'm not sure if this limit also applies to the zscript code equivalent, so you may want to just define the direction to simply call an alias or function and then build the alias or function with the meat of the code you wanted to put into the direction.
_________________
EDIT: I didn't like my old signature
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Jun 23, 2007 1:30 pm   
 
Or, how about creating a room script trigger?

Then when you follow who/what ever cave the trigger for that room will fire and #move you out?
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
sheetan
Beginner


Joined: 07 May 2007
Posts: 19

PostPosted: Sun Jun 24, 2007 6:04 am   
 
Yeah, it works..but my main question was to actually make this script!...the one where I "backtrack" all my steps to reach the room where I started
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Jun 25, 2007 10:28 am   
 
Once zMUD understands what the reverse of cave is as Matt described, or can get out another way, you can just do something like this:

#var DirList ""
#trig {You follow your leader (%w)} {#additem DirList ""}
#alias BackMove {#if (%reversedir(%item(@DirList,1))) {#exec %reversedir(%pop(@DirList))} {#say I don't know how to move the reverse of %pop(@DirList)!}}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
sheetan
Beginner


Joined: 07 May 2007
Posts: 19

PostPosted: Tue Jun 26, 2007 9:55 am   
 
It didn't work...even if the Directions were normal, it would tell me "I don't know how to move the reverse of !"
Reply with quote
sheetan
Beginner


Joined: 07 May 2007
Posts: 19

PostPosted: Wed Jun 27, 2007 3:54 pm   
 
and shouldn't the %pop(@Dirlist) be %pop(Dirlist)
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed Jun 27, 2007 4:16 pm   
 
Yes it should %pop
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
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