SHARE
TWEET

Untitled

a guest Apr 27th, 2016 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2.  
  3. use Minecraft::RCON;
  4. use IO::Handle;
  5. STDOUT->autoflush(1);
  6.  
  7. my $tpuser = 'USERNAME';
  8. my $jumpdistance = 100;
  9. my $height = 250;
  10.  
  11. my $quickskip = 14107;
  12. # Lenght of the segment of movement
  13. my $segment = 121;  # Normally would be 1;
  14. my $pass = 95; # Normally would be 0;
  15. # Direction and Vecator
  16. my $dx = 1;  # Normall would be 1;
  17. my $dz = 0;  # Normally would be 0;
  18.  
  19. # Current Vector and Direction
  20. my $x  = 35;  # Normally would be 0;
  21. my $z  = -59;  # Normally would be 0;
  22.  
  23. my $startx = -8048;
  24. my $startz = -8064;
  25.  
  26. my $endx = 7952;
  27. my $endz = 7936;
  28.  
  29. my $jumps = 16000;
  30.  
  31.  
  32. my $rcon = Minecraft::RCON->new( { address => 'ADDRESS', password => 'PASSWORD' } );
  33. if ($rcon->connect){
  34.     #print $rcon->command('help');
  35.     # Direction and Vector direction
  36.  
  37.     #my $x = 0;
  38.     #my $z = 0;
  39.     #my $pass = 0;
  40.     for( my $k = $quickskip; $k < $jumps; ++$k) {
  41.        # make step, add direction veector to current possition
  42.        $x += $dx;
  43.        $z += $dz;
  44.        ++$pass;
  45.        #print "Moving $x $z on $pass\n";
  46.        my $locx = $x * $jumpdistance;
  47.        my $locz = $z * $jumpdistance;
  48.        print "Moving $locx $locz on $pass / $segment ($k $dx $dz [$x $z])\n";
  49.        print $rcon->command("say moving $tpuser to $locx $height $locz");
  50.  
  51.        my $output = $rcon->command("tp $tpuser $locx $height $locz");
  52.        if( $output =~ /^Player/ )
  53.         {
  54.           print "Exiting due to player missing...\n";
  55.           exit(1);
  56.         }
  57.        if( $k < $quickskip )
  58.         { print "sleep 1\n"; sleep(1); }
  59.        else
  60.         { print "sleep 10\n"; sleep(10); }
  61.        if( $pass == $segment ) {
  62.            if( $k > $quickskip ) {
  63.              print "sleep 45\n";
  64.              sleep(45);  #pause longer each segment
  65.            }
  66.            my $save = $dx;
  67.            $pass = 0;
  68.            $dx = -$dz;
  69.            $dz = $save;
  70.            ++$segment if( $dz == 0 );
  71.        }
  72.  
  73.        #print $rcon->command("tp $tpuser 5650 $height 0");
  74.      }
  75.  #   sleep 10;
  76.  #   print $rcon->command('forge tps 0');
  77. }
  78. else {
  79.     print "Oh dang, connection failed!\n";
  80.     # Error capturing and fetching is in the works...
  81. }
  82. $rcon->disconnect;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top