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

[error] with turtle.dropDown()

Started by The, 20 November 2012 - 04:22 AM
The #1
Posted 20 November 2012 - 05:22 AM
I'm having a problem with this turtle mining program I'm working on. When the turtle return to drop its items it says it attempted to index a nil value(line 18) but I do not understand the problem or what needs to be done. Perhaps you can help. Thank you!


term.clear()
term.setCursorPos(1,1)
amountOfTimes = 20
while true do
for a = 1,amountOfTimes do
turtle.dig()
turtle.forward()
turtle.digUp()
end
turtle.turnRight()
turtle.turnRight()
break
end
for a = 1, amountOfTimes do
turtle.forward()
end
for i = 1,9 do
turtle.dropDown()
end
turtle.turnLeft()
turtle.forward()
turtle.turnRight()

This meant to be done endlessly, clearing a large area.
Orwell #2
Posted 20 November 2012 - 05:32 AM
You probably have a spelling error or a non existing function in there, but I can't spot it. :(/>/> Another question… You have 'while true do' and at the end of that loop you have a 'break' statement. So the loop will always run exactly once. Is this intended?
Lyqyd #3
Posted 20 November 2012 - 06:38 AM
Which version are you on?
The #4
Posted 20 November 2012 - 07:41 AM
computercraft 1.3
Kingdaro #5
Posted 20 November 2012 - 08:01 AM
Ouch, I don't think dropDown and dropUp are supported in anything before 1.4.
jay5476 #6
Posted 20 November 2012 - 11:51 AM
there not sorry update if ur using tekkit and its easy to do
1. delete computercraft.zip and download latest 1
2. put in mods folder
3. ur done
Orwell #7
Posted 20 November 2012 - 12:33 PM
there not sorry update if ur using tekkit and its easy to do
1. delete computercraft.zip and download latest 1
2. put in mods folder
3. ur done
I don't think tekkit has updated to Minecraft 1.4.4 yet, has it?
Kingdaro #8
Posted 20 November 2012 - 01:11 PM
Tekkit is still on Minecraft version 1.2.5, I believe. Severely outdated.

I recommend using Feed the Beast, if you don't mind a lack of redpower.
ChunLing #9
Posted 20 November 2012 - 04:50 PM
ComputerCraft 1.41 works with MineCraft 1.2.5, and it supports most of the new functions.
Lyqyd #10
Posted 20 November 2012 - 04:52 PM
I believe Tekkit is bukkit-based, rather than using the vanilla server. If this is the case, one would need the bukkit-ported version of ComputerCraft 1.41, I believe. If you play on a server, the whole server would need to manually update in order to use it.
Kingdaro #11
Posted 20 November 2012 - 05:54 PM
ComputerCraft 1.41 works with MineCraft 1.2.5, and it supports most of the new functions.
Regardless, tekkit only has 1.33.
Luanub #12
Posted 20 November 2012 - 06:06 PM
ComputerCraft 1.41 works with MineCraft 1.2.5, and it supports most of the new functions.
Regardless, tekkit only has 1.33.
Since tekkit is MineCraft 1.2.5 you can update it manually to have CC 1.41

I believe Tekkit is bukkit-based, rather than using the vanilla server. If this is the case, one would need the bukkit-ported version of ComputerCraft 1.41, I believe. If you play on a server, the whole server would need to manually update in order to use it.

You're correct, it is based off bukkit so you will need to use a bukkit port.
Kingdaro #13
Posted 20 November 2012 - 06:11 PM
ComputerCraft 1.41 works with MineCraft 1.2.5, and it supports most of the new functions.
Regardless, tekkit only has 1.33.
Since tekkit is MineCraft 1.2.5 you can update it manually to have CC 1.41
At that point there's no point in using tekkit anymore since you can't join any tekkit servers. Tekkit was made mainly for SMP, serving as a sort of Technic for SMP, and people who play Tekkit usually don't have CC as a top priority, therefore they won't be upgrading. This applies to server hosts as well.

My point though, if anything, he should upgrade technic instead of tekkit, so that he doesn't risk SMP connectivity.
Luanub #14
Posted 20 November 2012 - 06:14 PM
Technic is already at 1.41 you don't need to update it.
Kingdaro #15
Posted 20 November 2012 - 06:16 PM
In that case, if he's on a server, he's screwed. If he's playing single player, why the hell is he using tekkit?
The #16
Posted 21 November 2012 - 04:38 AM
I've changed it to turtle.drop() which satisfies my purposes and I appreciate the info regarding upgrading to 1.41 on a tekkit server because that is in fact what I play on.

However, a new problem has arisen with the code. When I run the program it goes until the end but does not go again as it should when I begin with "while true do" in such a way, correct?

In this new version i change dropDown() to drop() and at the end I corrected the way it goes to the next tunnel.

term.clear()
term.setCursorPos(1,1)
amountOfTimes = 20
while true do
for a = 1,amountOfTimes do
turtle.dig()
turtle.forward()
turtle.digUp()
end
turtle.turnRight()
turtle.turnRight()
break
end
for a = 1, amountOfTimes do
turtle.forward()
end
for i = 1,9 do
turtle.drop()
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()


I thought to end the entire program with end but i get an error when doing that so what must be done to get the whole thing on a loop?
Lyqyd #17
Posted 21 November 2012 - 04:48 AM
You have a while true do in there, sure. But as soon as you reach the end of the loop the first time, you break out of it. Try removing the break and moving the end that follows it to the end of the program.
ChunLing #18
Posted 21 November 2012 - 04:50 AM
You have a break right at the end of the while loop. This means that it will never execute more than once, since the break is unconditional.

Hah, ninja'd. Oh well, here's an indented version of the code, while I'm at it.
term.clear()
term.setCursorPos(1,1)
amountOfTimes = 20
while true do --loop goes from here
    for a = 1,amountOfTimes do
        turtle.dig()
        turtle.forward()
        turtle.digUp()
    end
    turtle.turnRight()
    turtle.turnRight()
    break
end -- and has the end here, but always hits the break first which terminates the loop
for a = 1, amountOfTimes do
    turtle.forward()
end
for i = 1,9 do
    turtle.drop()
end
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
 
Edited on 21 November 2012 - 03:53 AM
The #19
Posted 21 November 2012 - 05:12 AM
Thank you, it now does its intended purpose.