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

Pathwalking: pause for combat, resume after. [Aardwolf]

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts
View previous topic :: View next topic  
Author Message
ixle



Joined: 15 Sep 2011
Posts: 158
Location: United States

PostPosted: Tue Feb 28, 2012 2:14 pm    Post subject: Pathwalking: pause for combat, resume after. [Aardwolf] Reply with quote

This script is part of a package downloadable at http://theixle.dyndns.org

This script will probably only work for Aardwolf unless the GMCP data your mud sends is identical. It should still serve as an interesting example for anyone else.

If you can see anything wrong, or any improvements that could be made, please elaborate.

Code:
#CLASS pathwalk kill
#CLASS pathwalk open

/*
   Class Name: pathwalk
   File Name:  pathwalk.tin
   Description:
      This simple script will utilize a variable (pos_number) set from GMCP to check if you are fighting before
      walking the next node of a path. If the 'pos_number' variable is '8', it will create a ticker to determine
      when you are no longer in a fight and resume walking the path. It also allows you to send commands while
      walking a path as opposed to #PATH RUN.
   Usage:
      1. Store a path somehow (#path load <blah>, #map find <blah>)
      2. Type 'rp'
      3. Settings should clear on end of path, use 'rpof' if all else fails.
*/

/*
   Setting 'pos_number' variable from GMCP:
      I would highly recommend using more complete gmcp data capturing script(s)
      such as these:
         
         http://theixle.dyndns.org/aardtin/aardwolf+tintin/gmcp.tin
         http://theixle.dyndns.org/aardtin/aardwolf+tintin/zzGMCP_to_stat.tin

      Otherwise, you will need to do something like this:

         #EVENT {IAC SB GMCP char.status IAC SE}
         {
                 #variable GMCP[CHAR][STATUS] {%0};
            #variable pos_number {$GMCP[CHAR][STATUS][state]}
         }
*/



/* This will be the main alias for initiating a path run(walk) */
#ALIAS rp
{
   /* Setting 'mapping' variable to 0 is required if using a gmcp mapper script to prevent double MAP EXIT ROOM events */;
   #VARIABLE {mapping} {0};
   #EVENT {MAP EXIT ROOM}
   {
      /* Check to see if we're fighting */;
      #IF {$pos_number == 8}
      {
         /* If fighting, create a ticker to watch for not fighting state, and display a message. */;
         #SHOW <179>[<119>Speedwalk<179>]<119>Fighting - creating ticker.<099>;
         #TICKER {path_wait}
         {
            /* This is important: You MUST have something that sets this variable from gmcp. */;
            #IF {$pos_number != 8}
            {
               /* When we're done fighting, remove the ticker and get back to the path. */;
               #UNTICKER {path_wait};
               #PATH walk
            };
            #ELSE
            {
               /* Let's display something while in a fight just for confirmation. */;
               #SHOW <179>[<119>Speedwalk<179>]<129>waiting...
            }
         } {.5}
      };
      #ELSE
      {
         /* If we're not fighting, just send the next path node and display something nice. */;
         #SHOW <179>[<119>Speedwalk<179>]<099>;
         #PATH walk
      }
   };
   /* This will handle cleaning everything up on normal termination of a path. */;
   #event {END OF PATH}
   {
      #SHOW <179>[<119>Speedwalk<179>]<129>Done.<099>;
      #VARIABLE mapping 1;
      #UNEVENT {MAP EXIT ROOM};
      #UNEVENT {END OF PATH};
   };
   /* Oops, something must be wrong, let's get out of the path and clean up. */;
   #ACTION {^Alas, you cannot go that way.}
   {
                #VARIABLE mapping 1;
                #UNEVENT {MAP EXIT ROOM};
                #UNEVENT {END OF PATH};
      #UNACTION {^Alas, you cannot go that way.}

   };
   /* Hrm, somehow the MAP EXIT ROOM event is still on but we have no nodes left in the path. */;
   #ACTION {#END OF PATH}
   {
      /* As before, setting the 'mapping' variable is only necessary if you use a gmcp mapping script that manually moves you in the tintin map. */;
                #VARIABLE mapping 1;
                #UNEVENT {MAP EXIT ROOM};
                #UNEVENT {END OF PATH};
                #UNACTION {#END OF PATH}
   };
   /* Let's make the rp alias start the path too. */;
   #PATH walk

}

/* If for some reason you need to clear the speedwalk, use this */
#ALIAS {rpof}
{
   #PATH load {#nop};
   #PATH walk
}

#CLASS pathwalk close
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 -> Finished Scripts 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