Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use Minecraft::RCON;
- use IO::Handle;
- STDOUT->autoflush(1);
- my $tpuser = 'USERNAME';
- my $jumpdistance = 100;
- my $height = 250;
- my $quickskip = 14107;
- # Lenght of the segment of movement
- my $segment = 121; # Normally would be 1;
- my $pass = 95; # Normally would be 0;
- # Direction and Vecator
- my $dx = 1; # Normall would be 1;
- my $dz = 0; # Normally would be 0;
- # Current Vector and Direction
- my $x = 35; # Normally would be 0;
- my $z = -59; # Normally would be 0;
- my $startx = -8048;
- my $startz = -8064;
- my $endx = 7952;
- my $endz = 7936;
- my $jumps = 16000;
- my $rcon = Minecraft::RCON->new( { address => 'ADDRESS', password => 'PASSWORD' } );
- if ($rcon->connect){
- #print $rcon->command('help');
- # Direction and Vector direction
- #my $x = 0;
- #my $z = 0;
- #my $pass = 0;
- for( my $k = $quickskip; $k < $jumps; ++$k) {
- # make step, add direction veector to current possition
- $x += $dx;
- $z += $dz;
- ++$pass;
- #print "Moving $x $z on $pass\n";
- my $locx = $x * $jumpdistance;
- my $locz = $z * $jumpdistance;
- print "Moving $locx $locz on $pass / $segment ($k $dx $dz [$x $z])\n";
- print $rcon->command("say moving $tpuser to $locx $height $locz");
- my $output = $rcon->command("tp $tpuser $locx $height $locz");
- if( $output =~ /^Player/ )
- {
- print "Exiting due to player missing...\n";
- exit(1);
- }
- if( $k < $quickskip )
- { print "sleep 1\n"; sleep(1); }
- else
- { print "sleep 10\n"; sleep(10); }
- if( $pass == $segment ) {
- if( $k > $quickskip ) {
- print "sleep 45\n";
- sleep(45); #pause longer each segment
- }
- my $save = $dx;
- $pass = 0;
- $dx = -$dz;
- $dz = $save;
- ++$segment if( $dz == 0 );
- }
- #print $rcon->command("tp $tpuser 5650 $height 0");
- }
- # sleep 10;
- # print $rcon->command('forge tps 0');
- }
- else {
- print "Oh dang, connection failed!\n";
- # Error capturing and fetching is in the works...
- }
- $rcon->disconnect;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement