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


Joined: 03 Jan 2008
Posts: 48

PostPosted: Wed Nov 09, 2011 11:00 pm   

moving around using path stored in a variable
 
I probably should've just posted this to begin with instead of spending all day hunting through everything, but I know I use to be able to store paths in string list variable and use them to walk where ever I wanted to go, basically making a speedwalk using a variable so I wouldn't have to keep everything mapped out. I've tried using #slow, #walk, and #step to get the path to execute, but it won't do so, I'm wondering if there is a specific reason why, or if perhaps I'm doing something wrong.
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Thu Nov 10, 2011 9:32 am   
 
It sounds like you want:
#mark
#path pathsave

You can also use this if you want. I would suggest changing somethings like alias names and the #oninput trigger you may want to change into aliases. Also, the ok alias is useless. Can't guarantee it'll work without flaws..
Code:
#CLASS {Path}
#ALIAS mark {#class Path/Record 1;#var Path/Record/lastPath {@Path/Record/currentRecording};#var Path/Record/currentRecording {};#show %ansi( hi, cyan)Beginning of path set}
#ALIAS slow {#var Path/paths/currentPath {%-1};#ADDKEY PathSteps {%replace( %-1, " ", "_")} {1};#exec {%item( @Path/paths/%-1, @{PathSteps.%replace( %-1, " ", "_")})}}
#ALIAS path {#show %replace( %-1, " ", "_");#if (%numitems( @Path/Record/currentRecording) > 0) {#var {Path/paths/%-1} {@Path/Record/currentRecording};#var Path/Record/pathBackups {%addkey( @Path/Record/pathBackups, %-1, @Path/Record/currentRecording)};#addkey PathSteps {%replace( %-1, " ", "_")} {0};#show %ansi(hi,cyan)@Path/Record/currentRecording saved to %-1} {#show %ansi(hi,red)Record something with mark first};#var Path/Record/currentRecording {};#class Path/Record 0}
#ALIAS step {#class Path/paths;#ADDKEY PathSteps {%replace( @Path/paths/currentPath, " ", "_")} {%eval( @{PathSteps.%replace( @Path/paths/currentPath, " ", "_")}+1)};#exec {%item( @{@Path/paths/currentPath}, @{PathSteps.%replace( @Path/paths/currentPath, " ", "_")})};#var Path/first {@{PathSteps.%replace( @Path/paths/currentPath, " ", "_")}};#var Path/second {%numitems( @{@Path/paths/currentPath})};#if (@Path/first >= @Path/second) {#show Path reset;#ADDKEY PathSteps {%replace( @Path/paths/currentPath, " ", "_")} {0}} {};#class 0}
#ALIAS fast {#loop %numitems( @%-1) {#exec {%item( @{%-1}, %i)}}}
#ALIAS pathpause {#class Path/Record 0;#show %ansi( hi, cyan)Recording paused}
#ALIAS pathadd {#var Path/Record/currentRecording {%additem( %-1, @Path/Record/currentRecording)};#show %ansi( hi, cyan)%-1 added to current recording}
#ALIAS pathdel {#show %ansi( hi, cyan)%item( @Path/Record/currentRecording, %numitems( @Path/Record/currentRecording)) %ansi( hi, red)removed;#DELNITEM Path/Record/currentRecording %numitems( @Path/Record/currentRecording)}
#ALIAS pathresume {#class Path/Record 1;#show Recording resumed}
#ALIAS backup {#ADDKEY PathSteps {%replace( @Path/paths/currentPath, " ", "_")} {%eval( @{PathSteps.%replace( @Path/paths/currentPath, " ", "_")}-1)}}
#ALIAS ok {#ADDKEY PathSteps {%replace( @Path/paths/currentPath, " ", "_")} {%eval( @{PathSteps.%replace( @Path/paths/currentPath, " ", "_")}+1)}}
#VAR currentPath {}
#VAR first {0}
#VAR second {0}
#CLASS 0
#CLASS {Path|Record}
#VAR pathBackups {}
#VAR lastPath {}
#VAR currentRecording {}
#ONINPUT {^(*)} {#var Path/Record/currentRecording {%additem( %1, @Path/Record/currentRecording)};#show %ansi( high, cyan) @Path/Record/currentRecording}
#CLASS 0
#CLASS {Path|paths}
#VAR currentPath {nothing}}
#CLASS 0
#CLASS {Path|paths|steps}
#VAR PathSteps {}
#CLASS 0
[/code]
Reply with quote
Einder
Novice


Joined: 03 Jan 2008
Posts: 48

PostPosted: Mon Nov 14, 2011 4:39 am   
 
That's actually way more complicated than what I was looking for. The scripts I use to use if I remember right used a command like #walk with a variable to move between rooms. It looked more like

Code:
#walk @path


I would use some other commands with it like #wait to dictate how long to wait in between each step and things like that. There was in a fact a finished script called The Hunter Bot that I based it off of but I can't find that script anymore either.
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Mon Nov 14, 2011 6:54 am   
 
Well this is what it sounds like you are asking for. When you use #mark, you start recording a path. When you use #path, you save that path to a path variable I think its called. You'll You should see a Paths button in the settings editor. (Ctrl+G, to get to the settings editor)

You have to use a path (path variable) with #slow and #step. That's probably the reason you are looking for, or what you are doing wrong. You are using a variable, not a path.

If you were really using stringlists, then I don't know. Maybe you were using %pop, or %item, and a stringlist in conjunction. Yeah, that could be it.
Code:
#alias walk {#loop %numitems(@%-1) {#wait 1000;%item(@%-1,%i)}}

Anyway, I think this might also help you:
Code:
#PATH path {sn3s2nweswenewnewn}
Reply with quote
Einder
Novice


Joined: 03 Jan 2008
Posts: 48

PostPosted: Mon Nov 14, 2011 7:54 am   
 
actually while testing a theory, I stumble across why things weren't working right, however, I also found that you can do something like this

Code:
#wait 2500
#step


as long as you make sure you have alias with

Code:
#slow @path


to start you walking. What I was doing before that I have to figure out, was keeping track of the number of moves I had made and triggering the next step from the string list variable based off that. I just don't remember how to trigger the next move based on the number in the string list anymore, once I remember that though, I'll pretty much be right back on track.


Don't get me wrong, I appreciate your help, but as the mud I play is always being updated, I experience lag issues using alarms as well as the way I just posted. The other way, makes it so that even when I lag I don't have to worry about resetting the path or sending to many commands, which really helps when I'm trying to collect ingredients.
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Mon Nov 14, 2011 8:00 am   
 
I think you should post more information. specifically, what are these numbers you are talking about? Are they in your @path variable? (show what's in the @path variable)

It seems you are remembering what you did. So, good luck.
Reply with quote
Einder
Novice


Joined: 03 Jan 2008
Posts: 48

PostPosted: Mon Nov 14, 2011 3:37 pm   
 
The numbers are stored in another variable. Basically what you would have would be something LIKE but NOT EXACTLY the following

Code:
#ALIAS test {
  #var mcount {%null}
  #slow @testpath
  }
#ALIAS nextstep {
  #ADD mcount 1
  #wait 2500
  #step
  }
#VAR testpath {s|w|w|w|e|e|e|n}
#VAR mcount {}


What I'm trying to remember how to do now, use what would be stored in mcount to trigger the next move in the string list testpath.
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Tue Nov 15, 2011 5:33 am   
 
Yeah, my big script i posted earlier uses the same idea; It stores the steps in another variable.
I think mcount should be just a number. You could pick a part my other posts to figure out how to move around.

Try this

Code:
#ALIAS nextstep {
  #ADD mcount 1
  #wait 2500
  #execute %item(@testpath,@mcount)
  }


I noticed you are using #step. Are you sure you're not wanting to use #path? #step isn't for normal variables, I thought..
Reply with quote
Einder
Novice


Joined: 03 Jan 2008
Posts: 48

PostPosted: Tue Nov 15, 2011 5:55 am   
 
Honestly I've tried #Path, #Step, #Slow, #Move, and #Walk. None of them have done anything at all, it just sits there, some I get a bad command echo, but that of course is what the testing is for :).

Your adjustment does work, very well in fact, the only problem I have now, is trying to figure out how to trigger the movement itself so its continuous and I don't have to manually put in next step every time I want to move
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Tue Nov 15, 2011 6:05 am   
 
#path test {esesesese}
#slow test
#step

You probably want to use #mark and #path to make paths. And #slow, #step, #pause, #ok to move. #paths are not your standard variables. (Sounds like you are wanting the 'paths' made from #path)
I believe you type something like #slow test. Not #slow @test.
Do you have the help files that come with zMud? They usually cover enough about the commands, but I know with #slow the example given isn't enough.
Reply with quote
Einder
Novice


Joined: 03 Jan 2008
Posts: 48

PostPosted: Tue Nov 15, 2011 6:52 am   
 
I have all the help files yes, unfortunately in this situation they haven't been any help. The problem with #path is that it creates the path as you move which is not what I want to do, I want to move along the path that I've already stored in a variable, but I want to be able to do so slowly and continuously. Basically what I have to be able to do, is like my variable @testpath, I need to be able to move .s3w3en with enough time in between commands to pick something up if I see it laying there. The only thing that stops me from using the #Alarm function to do this, is that like I mentioned before, when I lag the commands end up continuously sent instead of pausing long enough for me to load the next room before continuing.
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: Tue Nov 15, 2011 7:07 am   
 
Sounds like you want #path test {wewe}
And this should work if you already have your paths stored in variables
#path test {%replace(@test,"|","")}

Otherwise, I think you need to make a script. You will need to keep track of the steps. You could make a trigger to figure NextStep. Or maybe you can use #loop.

Edit:
You don't have to walk around to use #path. Typing into the command line: #path test {wewe} will work.
Reply with quote
Einder
Novice


Joined: 03 Jan 2008
Posts: 48

PostPosted: Tue Nov 15, 2011 10:15 pm   
 
I appreciate all your help, what I ended up with was something more like this:

Code:
#CLASS {test}
#ALIAS test {
  #slow testpath
  #pause
  }
#ALIAS nextstep {
  #wait 1000
  #step
  #pause
  }
#PATH testpath {s3w3en}
#CLASS 0
#CLASS {test|walk}
#TRIGGER {~[ (*) ~]} {nextstep}
#CLASS 0


Which perfectly solved my movement problem without overflowing anything. I still of course have other triggers to add for collecting the items and stuff as I walk along the path, but your suggestion did help a lot and is much appreciated :)


EDIT: For those curious, you will need the #alarm command with this, and you must remember to suspend your alarm when you need to stop, otherwise it will continue to try and go. Issue solved, on to my next problem!
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