Advertisement
Ichabod2032

Minecraft Turtle Attack Script

Apr 1st, 2013
868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. --2013 Ichabod_Clay (Ichabod2032)
  2. --Attack Script for Turtles in Minecraft
  3. --This is an extremely simple attack script for the Melee Turtle in Minecraft. It will attack
  4. -- whatever is in front of it every second or so. If it hasn't attacked anything in a predetermined
  5. -- amount of time, the script will automatically exit, which lessens CPU load. Yay!
  6.  
  7. local counter = 0;
  8. local arguments = {...};
  9.  
  10. if #arguments ~= 1 then
  11.     print("Usage: <program name> <timeout in seconds>");
  12.     return;
  13. end
  14.  
  15. local timeout = tonumber(arguments[1]);
  16. if timeout < 1 then
  17.     print("The timeout must be a positive number");
  18. elseif timeout > 300 then
  19.     print("The timeout must be smaller than 5 minutes");
  20. end
  21.  
  22. while true do
  23.     while true do
  24.         if not turtle.attack() then
  25.             counter = counter + 1;
  26.             break;
  27.         else
  28.             counter = 0;
  29.         end
  30.     end
  31.  
  32.     sleep(1);
  33.  
  34.     if counter >= timeout then
  35.         print("Program timed out.");
  36.         return;
  37.     end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement