TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

#path walk problrem

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
dorian



Joined: 29 Jul 2012
Posts: 66

PostPosted: Sat May 06, 2017 4:01 am    Post subject: #path walk problrem Reply with quote

Hi this issue may be trivial, but I cant figure out so far.

in my mud I have situation when some exits works only when you tried so much, like multiple times, ie: climb tree or go thought bush,
so i have many actions that do #map undo for me

how to code that in some kind of #path run function that is try some step again if was not successfull?

so far i have this:
Code:

#alias path_walk {
   #path {save} {forward} {_path};
   #list {route} {create} ${_path};

   #if {"$_path" != ""} {
      #var _path_walk 1;
      #if {"%0" == ""} {
         #var step 0;
      } {
         #var step %0;
      }
      #list route {size} {v};
      #math {step} {$step+1};
      #math vv {$v+1};
      #if {$step < $vv} {
         #delay {1} {
            $route[$step];
            path_walk $step;
         };
      }
      #if {$step > $v} {
         #var _path_walk 0;      
      }
   };
}



Code:

#alias mu {
   #map undo;
   #if {$_path_walk == 1} {
      #math {step} {$step-1};
      #delay 1 {path_walk $step};
   };
}
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Fri May 19, 2017 6:58 pm    Post subject: Reply with quote

I came out with this for now, it walks the full path, one step every second

Code:

#var pathbackup {};
#var dirs {e;s;n;u};
#path load $dirs;

#ticker autowalk
{
    #var pathcheck {};
    #path save forward {pathcheck};
    #path save forward {pathbackup};
    #if {"$pathcheck"!=""} {#path walk;} {#unticker {autowalk}};
} {1}

#action {You failed}
{
    #map undo;
    #path load {$pathbackup};
}


If it fails, reloads the path as it was before the last step.

The "pathcheck" variable is needed to find out when the path is empty, and must be initialized emply before the path save, because for some reason, path save doesn't set it if the path is empty...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help All times are GMT - 5 Hours
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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group