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

shortest #path

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



Joined: 08 Oct 2007
Posts: 33

PostPosted: Wed Jun 11, 2008 3:55 pm    Post subject: shortest #path Reply with quote

Hello!

I think I might be able to swing this one on my own, but at the moment I'm stuck I was hoping to get a tip or two in the right direction..

I want to keep a #path of where I walk from a given starting point, but I don't want to record the path if I am backtracking..

IE: I walk :

n n w w e e n u

I don't want to record the (w w e e) part so that I can give my group mates shortest directions which in this case would be n n n u (it would be even better if i could just tell them 3nu but thats another question I suppose)

Here is the code i have so far, it works fine so long as I don't walk down a hallway with more than one direction of the same type. like the example above, it will only backtrack one room.

Code:

#ALIAS tpath {
        #IF {$auto_path == 1} {
                #VAR auto_path 0;
                #path end;
                #ECHO {%c%h} {{red} { PATHING OFF }}
                } {
                #VAR auto_path 1;
                #VAR lastpath q;
                #ECHO {%c%h} {{green} { PATHING ON }};
                #PATH new;#PATH end;
                #UNVAR result
        }

}

#FUNCTION dopath {
    #IF {$auto_path == 1} {
        #IF {"$lastpath" == "n" && "%1" == "s"} {#path del;#var result s;#var lastpath s} {
            #IF {"%1" == "s"} {#var lastpath s;#path ins s;#var result s}};
        #IF {"$lastpath" == "e" && "%1" == "w"} {#path del;#var result w;#var lastpath w} {
            #IF {"%1" == "w"} {#var lastpath w;#path ins w;#var result w}};
        #IF {"$lastpath" == "s" && "%1" == "n"} {#path del;#var result n;#var lastpath n} {
            #IF {"%1" == "n"} {#var lastpath n;#path ins n;#var result n}};
        #IF {"$lastpath" == "w" && "%1" == "e"} {#path del;#var result e;#var lastpath e} {
            #IF {"%1" == "e"} {#var lastpath e;#path ins e;#var result e}};
        #IF {"$lastpath" == "d" && "%1" == "u"} {#path del;#var result u;#var lastpath u} {
            #IF {"%1" == "u"} {#var lastpath u;#path ins u;#var result u}};
        #IF {"$lastpath" == "u" && "%1" == "d"} {#path del;#var result d;#var lastpath d} {
            #IF {"%1" == "d"} {#var lastpath d;#path ins d;#var result d}};
    } {
    #var result %1
    }
}

#ACT {Alas, you cannot go that way. . . .} {#IF {$auto_path == 1} {#VAR lastpath q;#path del}}


Thanks for any help about this!
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Wed Jun 11, 2008 4:17 pm    Post subject: Reply with quote

The automapper would come in useful here, if you paste the following commands it should record and display the shortest path:

#map create
#map goto 1
#map name start

n;n;w;w;e;e;n;u

#map name end

#map goto start
#map find end
#path map


I've added a #path compress option to the todo list to create a speedwalk.
Back to top
View user's profile Send private message Send e-mail
gfbaer



Joined: 08 Oct 2007
Posts: 33

PostPosted: Wed Jun 11, 2008 4:39 pm    Post subject: Reply with quote

Thumbs Up

Ok that works great! Big ups for the help!

I don't suppose there is an easy way to convert that path into a speedwalkable variable is there? I'm thinking I'll have to save the path, then #system some awk-fu to conver the :

#ALIAS {mypath} {n;e;s;s;e;u;u;w}

TO

#VAR {mypath} {ne2se2uw}

... Maybe something else for a future release? Coffee You're awesome man thanks for the help again.

-G

(alks on torilmud.org 9999)
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3274

PostPosted: Wed Jun 11, 2008 5:01 pm    Post subject: Reply with quote

I'm planning to add the following:

#path new
#PATH: YOU ARE NOW MAPPING A PATH.
n;n;n;e;s;w;u;d
#path compress
#OK. #PATH COMPRESS: {3neswud} {duwse3n}
#path map
#PATH: 3neswud
Back to top
View user's profile Send private message Send e-mail
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