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

[SOLVED]Turtle sorting machine: attempt to call nil

Started by edition2011, 18 September 2012 - 03:03 PM
edition2011 #1
Posted 18 September 2012 - 05:03 PM
Hello

I have downloaded the code of a sorting machine, but somehow I do get an error: Attempt to call nil

This is the code:

function sortStuff()
turtle.suck()
if turtle.compareTo(2) == true then shell.run("coal")
elseif turtle.compareTo(3) == true then shell.run("Spiston")
elseif turtle.compareTo(7) == true then shell.run("piston")
elseif turtle.compareTo(16) == true then shell.run("flint")
elseif turtle.compareTo(12) == true then shell.run("redstonetorch")
elseif turtle.compareTo(4) == true then shell.run("redstone")
elseif turtle.compareTo(10) == true then shell.run("stone")
elseif turtle.compareTo(11) == true then shell.run("cobblestone")
elseif turtle.compareTo(8) == true then shell.run("redstonerepeater")
elseif turtle.compareTo(9) == true then shell.run("dirt")
elseif turtle.compareTo(5) == true then shell.run("goldore")
elseif turtle.compareTo(6) == true then shell.run("ironore")
elseif turtle.compareTo(13) == true then shell.run("sandstone")
elseif turtle.compareTo(14) == true then shell.run("sand")
elseif turtle.compareTo(15) == true then shell.run("stonebricks")
else shell.run("other")
end
end
shell.run("clear")
print "Robotic Sorting Machine- enter SORT to run organization program."
input=read()
if input == "SORT" then shell.run("clear")
print "Working...because you're too lazy to do this yourself..."
end
for x=1,27 do sortStuff()
end

The link with the ZIP (The startup + movements files):
http://www.mediafire...5mrk56mm6hck5cw

Hope somebody can help me out.
Greets
Lion4ever #2
Posted 18 September 2012 - 05:15 PM
did you have the other programs that you call, too?
do you get a line where this happend?
edition2011 #3
Posted 18 September 2012 - 05:17 PM
starup:2: attempt to call nil

I will add the ZIP folder with all the other programs in the first post
edition2011 #4
Posted 18 September 2012 - 05:21 PM
And maybe good to know: I a using tekkit, so not the 1.4 version but the 1.33 (I think)
Cranium #5
Posted 18 September 2012 - 05:53 PM
Turtle.suck, and several other functions there are not available for the currently supported Tekkit version. Tekkit only runs 1.33. Check this page out to see what functions are supported for turtles.
edition2011 #6
Posted 18 September 2012 - 05:57 PM
Turtle.suck, and several other functions there are not available for the currently supported Tekkit version. Tekkit only runs 1.33. Check this page out to see what functions are supported for turtles.

Thanks