Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
zeek6728

my robot cant break blocks anymore

Question

I made my first tier 3 robot and I gave it the same program that I gave to my other but i change the program so it will repeat if an object is still in front of it
i give it the same tool for mining like i always have a Diamond Drill from industrialcraft
but it just swing at the Block doing the little puff of smoke animation without breaking the block i even gave it a normal pick
I tried to pick it up and put it back down but it's the same thing I even restarted the world
 

in case it's my programming that is wrong here's my script

local robot = require("robot")
local component = require("component")
local g = component.generator


local x = 0

function dig()
  
  repeat
    if g.count() < 10 and robot.count(2) > 1 then
      robot.select(2)
      g.insert(1)
      robot.select(1)
    end
    if robot.detectUp == true then
      repeat
        robot.swingUp()
        os.sleep(1)
      until(robot.detectUp == false)
    end
    if robot.detect == true then
      repeat
        robot.swing()
        os.sleep(1)
      until(robot.detect == false)
    end
    robot.forward()
    if robot.detectDown() == false then
      robot.placeDown()
    end
    x = x + 1
  until(robot.durability() == 0 or robot.count(robot.inventorySize()) > 0)
  robot.turnAround()
  repeat
    robot.swing()
    robot.forward()
    x = x - 1
  until(x == 0)
  
  repeat
    os.sleep(1)
  until(robot.durability() > 0 and robot.count(robot.inventorySize()) == 0)
  robot.turnLeft()
  for i = 0,2 do
    if robot.detectUp == true then
      repeat
        robot.swingUp()
        os.sleep(1)
      until(robot.detectUp == false)
    end
    if robot.detect == true then
      repeat
        robot.swing()
        os.sleep(1)
      until(robot.detect == false)
    end
    robot.forward()
    if robot.detectDown() == false then
      robot.placeDown()
    end
  end
  robot.turnLeft()
end

while(true) do
  dig()
end

 

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.