Cabius Posted December 31, 2012 Posted December 31, 2012 Ok I am trying to make a turtle place a single layer of blocks across a 24X40 block area. Could some one help me write the program? I tried to do something like turtle.place() turtle.moveBack() turtle.place() But it doesn't work and I cant make it do a 24X40 area. Any help would be appreciated. Thankyou. It wouldn't be bad to have it remove the next block behind it to so I don't have to clear the layer of blocks before putting the turtle down. Maybe at the start of the program it would dig down one block then dig behind it then place one in front then dig behind again then place and so fourth. I suppose it would have to not pick up the blocks it is digging so its inventory doesn't get full.
Linear_Spoon Posted December 31, 2012 Posted December 31, 2012 This has a decent amount of error checking (blocked path, no fuel, out of blocks). If turtle's don't need fuel on your server the script should still work OK in CC 1.41. If your server is still 3.1.2, you might need to remove the function about refueling. There is no turtle.digBehind() so while yes, it is possible, it would require your turtle to do a complete rotation to check/dig the block behind then return to the starting direction. The other option is to go forwards and dig the area before starting to place blocks, but this would take up twice as much fuel. If you want to add this, it's up to you. --the turtle places blocks for 'height' blocks, then turns around and repeats until it has placed 'width' rows local width = 40 local height = 24 function back() if not turtle.back() then print("Something's in the way!") return false end return true end function refuel(needed) while turtle.getFuelLevel() < needed do selected = 0 while(turtle.refuel(1) == false) do selected = selected + 1 if selected == 17 then print("Out of fuel!") return false end turtle.select(selected) end end return true end function place() selected = 0 while(turtle.place() == false) do selected = selected + 1 if selected == 17 then print("Out of blocks or block already placed!") return false end turtle.select(selected) end return true end for w = 1, width do if not refuel(height + 2) then return end for h = 2, height do if not (place() and back()) then return end end if not place() then return end if w % 2 == 0 then turtle.turnRight() else turtle.turnLeft() end if not back() then return end if w % 2 == 0 then turtle.turnRight() else turtle.turnLeft() end if not (back() and back()) then return end end print("Job finished successfully") Edit: Alternately, you could modify this script to make the turtle go forwards and dig/place blocks *under* it..but now that I've posted it I'm not going to do it unless necessary
Cabius Posted December 31, 2012 Author Posted December 31, 2012 Thankyou, I really wish I could copy and paste it into the turtle. I typed it all in then I accidentally deleted the turtle. :(
kmen117 Posted January 1, 2013 Posted January 1, 2013 Cabius copy and paste that code go into your tekkit folder and look for the computercraft folder and go into programs and create a new text document and paste the code and save the document
AstroGamerSteve Posted January 14, 2013 Posted January 14, 2013 Can you program a turtle to rotate blocks?
Linear_Spoon Posted January 14, 2013 Posted January 14, 2013 The command to place blocks is turtle.place(). It has no parameters for orientation. Some blocks like stairs will be placed differently depending on the direction the turtle is facing, but not all.
AstroGamerSteve Posted January 15, 2013 Posted January 15, 2013 Okay, so there is no command for a turtle to rotate blocks. Is there any other way to automatically rotate a frame motor? That's really what I want to do, because annoyingly, when it gets placed it points the conveyor downwards, the least useful way.
theprolo Posted January 15, 2013 Posted January 15, 2013 Okay, so there is no command for a turtle to rotate blocks. Is there any other way to automatically rotate a frame motor? That's really what I want to do, because annoyingly, when it gets placed it points the conveyor downwards, the least useful way. So THAT'S what you wanted. You should have been more specific, because that's easy. Use a screwdriver/sonic screwdriver. Right clicking will turn the direction it moves stuff, shift-right clicking it will change the side it moves from. While a turtle and deployers can do a normal right click if given a screwdriver, only you will be able to do the shift-right click.
AstroGamerSteve Posted January 15, 2013 Posted January 15, 2013 No, not manually, it needs to be fully automated. What's this about a turtle being able to right click with a wrench (It's a wrench for frame motors, not a screwdriver)
theprolo Posted January 15, 2013 Posted January 15, 2013 You should be able to move that frame motor with another frame motor, just make sure the frame motor isn't trying to move itself.
AstroGamerSteve Posted January 15, 2013 Posted January 15, 2013 Okay, I'll try that out. But can a turtle right click with a wrench?
theprolo Posted January 15, 2013 Posted January 15, 2013 It should be able to, using the turtle.place() command.
AstroGamerSteve Posted January 15, 2013 Posted January 15, 2013 Would anyone be able to write a code for a turtle which does the following? wait until there is a block in front uses a wrench three times with turtle.place() wait until there is no block in front moves forward once and continues this script forever? I would be extremely grateful.
Linear_Spoon Posted January 15, 2013 Posted January 15, 2013 Not tested: while true do while not turtle.detect() do sleep(1) end turtle.place() turtle.place() turtle.place() while not turtle.forward() do sleep(1) end end
AstroGamerSteve Posted January 15, 2013 Posted January 15, 2013 Not tested: while true do while not turtle.detect() do sleep(1) end turtle.place() turtle.place() turtle.place() while not turtle.forward() do sleep(1) end end So this will make it do so forever? I'll test it out tomorrow BTW you deserve a like, but I can't find the like button :L
AstroGamerSteve Posted January 18, 2013 Posted January 18, 2013 Cabius copy and paste that code go into your tekkit folder and look for the computercraft folder and go into programs and create a new text document and paste the code and save the document C:\Users\PCUSERNAME\AppData\Roaming\.techniclauncher\tekkit\mods\ComputerCraft\lua\rom\programs\turtle Alternatively, actually paste the file directory? Much better.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now