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

turtle.select(3) throws up error, turtle.select(2) doesn't.

Started by Castaras, 25 May 2013 - 10:01 AM
Castaras #1
Posted 25 May 2013 - 12:01 PM
I'm working on a turtle program that digs out and builds rooms and tunnels for me. I created a tunnel program which works fine and dandy, but am running into issues with creating my first room program.


function clear()
if turtle.detect() then turtle.dig() end
end

function clearForward()
if turtle.detect() then turtle.dig() end
turtle.forward()
end

function clearUp()
if turtle.detectUp() then turtle.digUp() end
turtle.up()
end

function clearDown()  
if turtle.detectDown() then turtle.digDown() end
end
function makeFloor(blockNo)
clearDown()
turtle.select(blockNo)
turtle.placeDown()
end

These are the functions I have at the top of my code. The issue is with the makeFloor function - when I put in the number 2 for slot 2, it works fine. Putting in number 3 for slot 3 causes the following error:

bios:337: [string "intersection"]:1: '=' expected

where intersection is the name assigned to the program on my turtle.

I've also tried just setting turtle.select(3) to the bottom instead of the makeFloor function and it's still throwing out the same error. Again, turtle.select(2) works fine.

Any ideas?

Edit: Now for some reason my tunneling program is no longer working and throwing up the same error. Link to it http://pastebin.com/N2bKdg8J here
Edited by
Lyqyd #2
Posted 25 May 2013 - 03:18 PM
Split into new topic.
Castaras #3
Posted 27 May 2013 - 01:26 PM
Thanks. Anyone with any ideas as to what's going on? :s
Bubba #4
Posted 27 May 2013 - 01:42 PM
Are you playing on Tekkit? It seems that Tekkit has a lot of weird bugs such as this (no idea why that would be though).

If not, my only suggestion is that you uninstall and then reinstall ComputerCraft. Possibly Forge as well, if you feel like being especially thorough.

Edit: Is it possible that you have a modified ROM or a startup program that would effect turtles in any way?
Castaras #5
Posted 28 May 2013 - 10:50 AM
'tis a custom modpack I'm playing with. Will try reinstalling Computercraft.
Pyro_ #6
Posted 28 May 2013 - 11:46 AM
Not related to your problem, but handy to know:

You should check for falling blocks when your turtle digs infront or above itself. You could refactor your code like so, to take advantage of this:


function clear()
while turtle.detect() do
turtle.dig()
sleep(0.8)
end
end

function clearForward()
while turtle.detect() do
turtle.dig()
sleep(0.8)
end
while not turtle.forward() do
turtle.attack()
end
end

function clearUp()
while turtle.detectUp() do
turtle.digUp()
sleep(0.8)
end
while not turtle.up() do
turtle.attack()
end
end

function clearDown()  
if turtle.detectDown() then
turtle.digDown()
end
end

function makeFloor(blockNo)
clearDown()
turtle.select(blockNo)
turtle.placeDown()
end

Note: falling blocks take 0.8 seconds to complete their fall.
Castaras #7
Posted 28 May 2013 - 01:04 PM
Not related to your problem, but handy to know:

You should check for falling blocks when your turtle digs infront or above itself. You could refactor your code like so, to take advantage of this:

*snip*

Note: falling blocks take 0.8 seconds to complete their fall.

Had completely forgotten about falling blocks, thanks for the tip! :D/>

Tried reinstalling computercraft and forge, and still having this issue, so taking it as a sign that I need to upgrade from 1.5.1 to 1.5.2. *sigh*


edit: So far, upgrading all my mods to 1.5.2 seems to have solved it, in case anyone else gets a similar issue. Thanks for listening, folks!
Pyro_ #8
Posted 29 May 2013 - 01:13 AM
Not related to your problem, but handy to know:

You should check for falling blocks when your turtle digs infront or above itself. You could refactor your code like so, to take advantage of this:

*snip*

Note: falling blocks take 0.8 seconds to complete their fall.

Had completely forgotten about falling blocks, thanks for the tip! :D/>

Tried reinstalling computercraft and forge, and still having this issue, so taking it as a sign that I need to upgrade from 1.5.1 to 1.5.2. *sigh*


edit: So far, upgrading all my mods to 1.5.2 seems to have solved it, in case anyone else gets a similar issue. Thanks for listening, folks!

You're welcome.