Jump to content




Pigmen Gold mining robot script.


2 replies to this topic

#1 Chaoscode

  • New Members
  • 2 posts

Posted 25 May 2014 - 11:57 AM

local valid = turtle.refuel(20)
local turn = 1;
print(valid)
while true do
if turtle.detect() then
  if turn == 1 then
   turtle.turnRight()
   turtle.forward()
   turtle.turnRight()
   turn = 0
  else
   turtle.turnLeft()
   turtle.forward()
   turtle.turnLeft()
   turn = 1
  end

else
  if turtle.forward()
   then
   print("Moving forward")
   if turtle.suck() then
	print("Picking up items")
   end
  else
   print("Mob Detected! Killing it")
   while turtle.forward() == false do
	turtle.attack()
   end
  
   if turtle.suck() then
	print("Picking up items")
   end
  
  end
end
end


#2 BrianHernando

  • New Members
  • 2 posts

Posted 28 May 2014 - 12:07 AM

What exactly does this do..?

#3 BlockSmith

  • Members
  • 56 posts

Posted 01 June 2014 - 06:05 PM

local valid = turtle.refuel(20)
local turn = 1;
print(valid)

while true do
  if turtle.detect() then --This part of the if else statement seems to make the turtle turn around if it hits a block.
	  if turn == 1 then
	    turtle.turnRight()
	    turtle.forward()
	    turtle.turnRight()
	    turn = 0
	  else
	    turtle.turnLeft()
	    turtle.forward()
	    turtle.turnLeft()
	    turn = 1
	  end
  else  --This part moves the turtle forward and sucks up any items on the floor.
    if turtle.forward() then
	  print("Moving forward")
	  if turtle.suck() then
	    print("Picking up items")
	  end
    else  --If the turtle cannot move forward then attack
	 print("Mob Detected! Killing it")
	 while turtle.forward() == false do
	   turtle.attack()
	 end
 
	 if turtle.suck() then
	   print("Picking up items")
	 end
 
  end
end
end

Not the most efficient way, but it'd work.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users