Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --2013 Ichabod_Clay (Ichabod2032)
- --Attack Script for Turtles in Minecraft
- --This is an extremely simple attack script for the Melee Turtle in Minecraft. It will attack
- -- whatever is in front of it every second or so. If it hasn't attacked anything in a predetermined
- -- amount of time, the script will automatically exit, which lessens CPU load. Yay!
- local counter = 0;
- local arguments = {...};
- if #arguments ~= 1 then
- print("Usage: <program name> <timeout in seconds>");
- return;
- end
- local timeout = tonumber(arguments[1]);
- if timeout < 1 then
- print("The timeout must be a positive number");
- elseif timeout > 300 then
- print("The timeout must be smaller than 5 minutes");
- end
- while true do
- while true do
- if not turtle.attack() then
- counter = counter + 1;
- break;
- else
- counter = 0;
- end
- end
- sleep(1);
- if counter >= timeout then
- print("Program timed out.");
- return;
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement