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

Temporary bridge maker :D!

Started by TheDeathOfRandom, 29 March 2012 - 02:46 AM
TheDeathOfRandom #1
Posted 29 March 2012 - 04:46 AM
This is a brand new program that I made for a member on my server to install into his TurtleOS thing… I thought it was pretty neat so I would like to share with the rest of the ComputerCraft Communty.

Spoiler–Bridge Creator/Destroyer :o/>/>
–Made By: EricRandom1023
–If Distributed Please Give Me Credit!
–I do not mind if you change anything.

function termClear()
term.clear()
term.setCursorPos(1,1)
end

function countItems()
s1 = turtle.getItemCount(1)
s2 = turtle.getItemCount(2)
s3 = turtle.getItemCount(3)
s4 = turtle.getItemCount(4)
s5 = turtle.getItemCount(5)
s6 = turtle.getItemCount(6)
s7 = turtle.getItemCount(7)
s8 = turtle.getItemCount(8)
s9 = turtle.getItemCount(9)
nItem = s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9
end

termClear()

countItems()
fx = nItem

repeat
turtle.placeDown()
turtle.forward()
until turtle.detectDown() == true

countItems()
sx = nItem
px = fx - sx

repeat
term.clear()
term.setCursorPos(1,1)
write("Used "..px.." blocks.\nBreak?\n")
x = read()
until x == "yes"

turtle.turnRight()
turtle.turnRight()
turtle.forward()

repeat
turtle.digDown()
turtle.forward()
px = px - 1
until px == 0

termClear()

write("Bridge Successfully Destroyed")

sleep(2)

termClear()

If there are any errors let me know… This is actually quite simple so you should be able to make it awesome :o/>/> just felt like throwin the idea out there.
hamish1001 #2
Posted 29 March 2012 - 04:52 AM
cool your server still online?
hamish1001 #3
Posted 29 March 2012 - 05:23 AM
doesnt work mate i don't see whats wrong with it….
ComputerCraftFan11 #4
Posted 29 March 2012 - 05:54 AM
This is a brand new program that I made for a member on my server to install into his TurtleOS thing… I thought it was pretty neat so I would like to share with the rest of the ComputerCraft Communty.

Spoiler–Bridge Creator/Destroyer :o/>/>
–Made By: EricRandom1023
–If Distributed Please Give Me Credit!
–I do not mind if you change anything.

function termClear()
term.clear()
term.setCursorPos(1,1)
end

function countItems()
s1 = turtle.getItemCount(1)
s2 = turtle.getItemCount(2)
s3 = turtle.getItemCount(3)
s4 = turtle.getItemCount(4)
s5 = turtle.getItemCount(5)
s6 = turtle.getItemCount(6)
s7 = turtle.getItemCount(7)
s8 = turtle.getItemCount(8)
s9 = turtle.getItemCount(9)
nItem = s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9
end

termClear()

countItems()
fx = nItem

repeat
turtle.placeDown()
turtle.forward()
until turtle.detectDown() == true

countItems()
sx = nItem
px = fx - sx

repeat
term.clear()
term.setCursorPos(1,1)
write("Used "..px.." blocks.nBreak?n")
x = read()
until x == "yes"

turtle.turnRight()
turtle.turnRight()
turtle.forward()

repeat
turtle.digDown()
turtle.forward()
px = px - 1
until px == 0

termClear()

write("Bridge Successfully Destroyed")

sleep(2)

termClear()

If there are any errors let me know… This is actually quite simple so you should be able to make it awesome :o/>/> just felt like throwin the idea out there.


Cool program
–xXm0dzXx
Ian-Moone #5
Posted 29 March 2012 - 08:05 AM
hamish did you put blocks in it?
TheDeathOfRandom #6
Posted 30 March 2012 - 03:27 AM
the script works you just need blocks in the turtle… if you make sure you copied it right it sho
doesnt work mate i don't see whats wrong with it….

Make sure that you have copied the code correctly. I don't know about you but sometimes the copy paste doesn't always work right from forums for me. If you don't find the error please post the error code/line thing and I'll see whats up. :o/>/>
EmTeaKay #7
Posted 11 April 2012 - 12:50 AM
You need to put periods in between term and clear() like term.clear() .
cant_delete_account #8
Posted 11 April 2012 - 01:09 AM
You need to put periods in between term and clear() like term.clear() .
Nope, he has a function called termClear()
bonobot #9
Posted 17 April 2012 - 07:21 PM
Right-off the bat I noticed countItems should look more like:


function countItems()
local nItem = { turtle.getItemCount(1) }
for i=2,9 do
  nItem = table.insert( nItem, turtle.getItemCount(i) )
  end
return nItem
end

I'll try to revise more tonight, but here's another thing…


while !turtle.detectDown() do
turtle.placeDown()
turtle.forward()
end