This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
figgycity50's profile picture

[MINING] Shafter

Started by figgycity50, 09 April 2013 - 05:44 AM
figgycity50 #1
Posted 09 April 2013 - 07:44 AM
Hi.
With Shafter mining just got WAAAY easier…

Yes it does.
This is my first ever turtle program.
I tested it several times and it works 100% (no bugs as far as I saw).
Download:
Pastebin: run pastebin get FSkhE64y shafter (old version)
CCbin: get the get/putter from my sig and use ccbin get 9xuxAn shafter (new version)

How to use:
  1. After installation, run shafter.
  2. Type a number (max 64)
  3. Let it run.
  4. 2 blocks above where it started place a chest.
  5. Once it finishes, the materials will be inside the chest (plus spare cave traversal blocks)
Feautures:
  • Traversable by Minecraftians and some mobs after use.
  • Customizable values
  • A way to use your spare ladders
  • Can even traverse THIN AIR and make it traversable by Minecraftians and mobs after traversing.
  • You won't lose the materials/turtle.
What the turtle needs:
  • The shafter script
  • Slot 1: Ladders/vines
  • Slot 2: Blocks for traversing THIN AIR.
Uses of the script:
  • Digging straight down without risking your life
  • If on a server, infiltrating other people's bases through the roof without getting spotted (Well, the turtle might get spotted though)
  • Going down a cliffhanger/ravine
unobtanium #2
Posted 09 April 2013 - 08:53 AM
Hello there,
sweet program you did there. I looked into the code and found some parts which can be improved :D/>

SpoilerAll this

bup = bdown + 1
for ups = 0, bup do
turtle.up()
end
turtle.select(2)
turtle.dropUp()
turtle.select(3)
turtle.dropUp()
turtle.select(4)
turtle.dropUp()
turtle.select(5)
turtle.dropUp()
turtle.select(6)
turtle.dropUp()
turtle.select(7)
turtle.dropUp()
turtle.select(8)
turtle.dropUp()
turtle.select(9)
turtle.dropUp()
turtle.select(10)
turtle.dropUp()
turtle.select(11)
turtle.dropUp()
turtle.select(12)
turtle.dropUp()
turtle.select(13)
turtle.dropUp()
turtle.select(14)
turtle.dropUp()
turtle.select(15)
turtle.dropUp()
turtle.select(16)
turtle.dropUp()

can be shortened by


for ups = 0, bdown+1 do
turtle.up()
end
for i=2,16 do
turtle.select(i)
turtle.dropUp()
end
I used a for loop for dumping all the items into the chest. I dont know why you dont want to have dumped the items from slot 1 into it?!
You dont need the extra variable. You can add one in the for loop.


Or even


while not turtle.detectUp() do
turtle.up()
end
for i=2,16 do
turtle.select(i)
turtle.dropUp()
end
Because the chest is at the surface it goes up until it hits the chest.

Btw, what would happen if the turtle hits a mob? It would try to move or place stuff, but the turtle is blocked and gets stucked while the program still keeps going. That means it would finish earlier then the user wanted to. I recommand for checking if stuff worked with a while loop like follow.

Spoiler

while not turtle.forward() do
turtle.attack()
sleep(0.2)
end
while not turtle.place() do
turtle.attack()
sleep(0.2)
end

That means the turtle checks if it could move or place something and if it doesnt it attacks and waits 0.2 seconds until it tries again to place or move. You can leave the "turtle.attack() sleep(0.2)" away if you dont like it. The turtle just waits for the mob to go away and keeps going afterwards.

One last thing you might be interested in your young career as programmer ;D

SpoilerFUNCTIONS <3
They are very helpfull if you need parts of your code multiple times like the while loops i showed you above.


function forward()
while not turtle.forward() do end
end
function place()
while not turtle.place() do end
end

forward()
place()
Whenever you need the while loops, you just have to use the command "forward()" or "place()" or whatever you called your function.

I hope that was helpfull. Keep up working :D/>
unobtanium
figgycity50 #3
Posted 25 August 2013 - 07:31 AM
does anyone have a copy? somebody removed the paste.
figgycity50 #4
Posted 21 September 2013 - 01:05 PM
does anyone have a copy? somebody removed the paste.
never mind, i managed to find it in my worlds (i like NEVER delete my worlds)
Edit: changed a bit up (using suggestions) and reputting it on my pastebin replacement, ccbin (link in my sig)

Edit: my sig is not there for some reason, go to my profile to find it