[Crossfire-wiki] [Crossfire DokuWiki] page changed: client_side_scripting:scripts:perl:travel

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Tue Dec 19 21:31:03 CST 2006


A page in your DokuWiki was added or changed. Here are the details:

Date        : 2006/12/19 21:31
User        : mhoram
Edit Summary: see ChangeLog

@@ -1,7 +1,7 @@
  ====== Travel Script ======
  
- This is an initial quick hack of a travel script.  It is designed to walk a character from the sign in Euthville to the fountain in Scorn, while staying on the roads for safety and speed.  The timing isn't quite right on getting through the gates, so you may get stopped there, but it should get you to the gates of Scorn, at least, until you bump into someone.  There's no collision detection or recovery from that sort of thing yet, so anything that blocks your movement will throw off the rest of the directions and send you who-knows-where.
+ This is an initial quick hack of a travel script.  It is designed to walk a character from the sign in Euthville to the fountain in Scorn, while staying on the roads for safety and speed.  The timing isn't quite right on getting through the gates, so you may get stopped there, but it should get you to the gates of Scorn, at least, unless you bump into someone.  There's no collision detection or recovery from that sort of thing yet, so anything that blocks your movement will throw off the rest of the directions and send you who-knows-where.
  
  If this sort of thing turns out to be useful, I'd probably move the "steps" pairs into a separate text file, and have one script that could read multiple "steps" files for different voyages.
  
  Here's the code, for anyone who would like to try it out.  Simply save it as a file, and execute the script with the command:  '''script perl /path/to/this/script''
@@ -48,13 +48,13 @@
  	      southwest => 3 ,
  	      south => 4 ,
  	      southwest => 2 ,
  	      west => 16,
- 	      stay => 6 ,
+ 	      stay => 5 ,
  	      west => 14,
  	      southwest => 1 ,
  	      command => 'apply' ,
- 	      stay => 6 ,
+ 	      stay => 5 ,
  	      northwest => 1 ,
  	      west => 16,
  	      northwest => 2 ,
  );
@@ -64,14 +64,29 @@
    my $value = shift @paces;
    last unless ( defined $key and defined $value );
    if( $key eq 'command' ){
      print "issue 1 1 $value\n";
+     wait_for_server();
    } elsif( $key eq 'stay' ){
      sleep $value;
+     next;
    } else {
      for my $steps (1..$value){
        print "issue 1 1 $key\n";
+       wait_for_server();
      }
    }
+ }
+ 
+ sub wait_for_server {
+   print "watch map2\n";
+   my $res = <STDIN>;
+   print "unwatch map2\n";
+   print STDERR $res;
  }
  </code>
+ 
+ ===== ChangeLog =====
+ 
+   * 2006.12.19 -- Added wait_for_server subroutine, which waits for a map2 command from server.  This is an attempt to keep the client from getting ahead of the server and losing commands.
+ 
  


IP-Address  : 206.71.197.56
Old Revision: http://wiki.metalforge.net/doku.php/client_side_scripting:scripts:perl:travel?rev=1166579406
New Revision: http://wiki.metalforge.net/doku.php/client_side_scripting:scripts:perl:travel

-- 
This mail was generated by DokuWiki at
http://wiki.metalforge.net/




More information about the crossfire-wiki mailing list