Hello all,
I've been teaching myself LUA and my latest creation I think is half decent enough that I'll share it with you guys too see what you think and maybe get some improvements.
Its a smart quarrying script that will dig a square quarry down to bedrock but importantly will only dig every 3rd layer comparing the layers above and below it to a list of filtered materials and ignoring them if they are on the filter.
Firstly credit where credit is due, the code is all my own but a lot of inspiration came from AustinKK's OreQuarry program on the computercraft forums. I used that program but wished it could retain its progress if the turtle became unloaded, for example stepping into a different mystcraft dimension so set about trying to make my own. So I present Jharakn's Quarry program.
Features:
Smart Quarry technology (tm) - cut down on the quantity of cobble, gravel and dirt produced
Amazing Fuel Efficiency compared to a buildcraft quarry
GPS uplink to automatically calculate positions
Automatic Position Saving - quarry will automatically restart (you need to set the startup program)
Setup:
1) firstly you need a GPS satellite or tower, if you don't know how to set one up there's a good guide here.
2) Label your turtle otherwise it will forget its code when it becomes unloaded, simple type "label set <turtle name>" into the turtle.
3) Load my quarry code into the turtle, again computercraft by default has an pastebin importer build in just type "pastebin get WzkjzJwB <program name>" into the turtle.
4) set your turtle up like this the wooden chest is for fuel, coal works best as the turtle will be pulling it out the ground but anything that burns works, whilst a turtle can burn buckets of lava my fuelCheck program can't handle it as the empty buckets confuses it.
5) set up the inventory of the turtle like this, fuel in slot 16 and the items you want to turtle to ignore in the first slots, you can have more or less than 3, if you wanted your turtle to quarry dirt for example you could remove it, likewise if you wanted to ignore iron ore you could add that to the list.
6) create a startup file for the turtle so it starts up when it loads again, you could just use:
but I prefer:
7) once your set up just run the program, if it has no previous instruction it'll ask you what size of quarry to dig then start, creating a new file called "QuarryInstructions". If it does find the quarry instructions file it'll just set off from where you left it.
8) profit???
as an aside I've got a small program that will print the status updates the turtle broadcasts to the rednet as it goes, just plug this into a computer attached to a monitor and and wireless modem.
also here
so try it out and let me know what you think.
I've been teaching myself LUA and my latest creation I think is half decent enough that I'll share it with you guys too see what you think and maybe get some improvements.
Its a smart quarrying script that will dig a square quarry down to bedrock but importantly will only dig every 3rd layer comparing the layers above and below it to a list of filtered materials and ignoring them if they are on the filter.
Firstly credit where credit is due, the code is all my own but a lot of inspiration came from AustinKK's OreQuarry program on the computercraft forums. I used that program but wished it could retain its progress if the turtle became unloaded, for example stepping into a different mystcraft dimension so set about trying to make my own. So I present Jharakn's Quarry program.
Features:
Smart Quarry technology (tm) - cut down on the quantity of cobble, gravel and dirt produced
Amazing Fuel Efficiency compared to a buildcraft quarry
GPS uplink to automatically calculate positions
Automatic Position Saving - quarry will automatically restart (you need to set the startup program)
Setup:
1) firstly you need a GPS satellite or tower, if you don't know how to set one up there's a good guide here.
2) Label your turtle otherwise it will forget its code when it becomes unloaded, simple type "label set <turtle name>" into the turtle.
3) Load my quarry code into the turtle, again computercraft by default has an pastebin importer build in just type "pastebin get WzkjzJwB <program name>" into the turtle.
4) set your turtle up like this the wooden chest is for fuel, coal works best as the turtle will be pulling it out the ground but anything that burns works, whilst a turtle can burn buckets of lava my fuelCheck program can't handle it as the empty buckets confuses it.
5) set up the inventory of the turtle like this, fuel in slot 16 and the items you want to turtle to ignore in the first slots, you can have more or less than 3, if you wanted your turtle to quarry dirt for example you could remove it, likewise if you wanted to ignore iron ore you could add that to the list.
6) create a startup file for the turtle so it starts up when it loads again, you could just use:
Code:
sleep(20) -- give the GPS satellites time to warm up
shell.run("<program name>")
Code:
if fs.exists("QuarryInstructions") == true then
sleep(20) --give the GPS satellites enough time to warm up
shell.run("<program name here>")
else
print("no instructions found, ready for use")
end
8) profit???
as an aside I've got a small program that will print the status updates the turtle broadcasts to the rednet as it goes, just plug this into a computer attached to a monitor and and wireless modem.
Code:
-- ************************************ --
-- Quarrying Turtle Monitoring Program --
-- By Jharakn --
-- ************************************ --
local monitor = peripheral.wrap("top")
rednet.open("left")
monitor.clear()
monitor.setCursorPos(1,1)
local line = {"-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-"}
while true do
local senderId, message, distance = rednet.receive()
print(message)
--line.1 = line.2; line.2 = line.3; line.3 = line.4; line.4 = line.5; line.5 = line.6; line.6 = line.7; line.7 = line.8; line.8 = line.9; line.9 = line.10; line.10 = line.11; line.11 = line.12
for i = 1,11 do
line[i] = line[i+1]
end
line[12] = message
for i = 1,12 do
monitor.setCursorPos(1,i)
monitor.clearLine()
monitor.write(line[i])
end
end
so try it out and let me know what you think.