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

Problem with torch placement(again)

Started by TheSwiftVlogger, 01 March 2014 - 06:57 AM
TheSwiftVlogger #1
Posted 01 March 2014 - 07:57 AM
hey guys so continuing on with the strip mining program, i have completely re-written the entire code, restructured the code so it is a lot cleaner, im having a problem with the torches not placing, here is the pastebin link for testing and hopefully bug fixes http://pastebin.com/Gs3pgpvP :D/>
CometWolf #2
Posted 01 March 2014 - 09:39 AM
i is not defined yet at this point in the code.

if i%6 == 0 then		  -- problem is here
	    turtle.select(2)
	    turtle.placeDown()
	    turtle.select(1)
end
TheSwiftVlogger #3
Posted 01 March 2014 - 10:14 AM
i is not defined yet at this point in the code.

if i%6 == 0 then		  -- problem is here
	    turtle.select(2)
	    turtle.placeDown()
	    turtle.select(1)
end

what should I define it to? still a noon here, are their any other bugs visible
CometWolf #4
Posted 01 March 2014 - 10:16 AM
I don't know what you intend to use i for, that's your job to know.

still a noon here
wat?

I can't point out bugs to you unless you explicitly tell me what's wrong ie "this function dosen't do what i want it to", or an error code.
TheSwiftVlogger #5
Posted 01 March 2014 - 10:24 AM
I don't know what you intend to use i for, that's your job to know.

still a noon here
wat?

I can't point out bugs to you unless you explicitly tell me what's wrong ie "this function dosen't do what i want it to", or an error code.

noob* (auto correct)

at the moment the only bug visible is its not placing torches down. from what I can see, only been "coding" for 5-6 days now still learning so my apologies.



I don't know what you intend to use i for, that's your job to know.

still a noon here
wat?

I can't point out bugs to you unless you explicitly tell me what's wrong ie "this function dosen't do what i want it to", or an error code.

noob* (auto correct)

at the moment the only bug visible is its not placing torches down. from what I can see, only been "coding" for 5-6 days now still learning so my apologies.
CometWolf #6
Posted 01 March 2014 - 10:24 AM
I can only assume that the code i posted above is the one responsible for placing torches, so it's a given that won't work…
TheSwiftVlogger #7
Posted 01 March 2014 - 12:08 PM
I can only assume that the code i posted above is the one responsible for placing torches, so it's a given that won't work…

Yeah it is ill, edit the pastebin link with comments of what everything does.. didnt think about that before posting. has now been updated. it does work for now, only it doesnt place torches, and i have implemented it dumping its inventory into a chest yet. that is my next task after i fix the torch issue
Bomb Bloke #8
Posted 01 March 2014 - 12:24 PM
If you took this code:

if i%6 == 0 then          -- problem is here   
        turtle.select(2)
        turtle.placeDown()
        turtle.select(1)
end

for i = 1, 100 do                      

        mine()
end

And restructured it like this (so the code to place torches is inside the "for" loop, like how you originally proposed):

for i = 1, 100 do                      
	mine()
	if i%6 == 0 then
		turtle.select(2)
		turtle.placeDown()
		turtle.select(1)
	end
end

… then 'i' would conveniently have a value that automatically goes up with every block the turtle mines forward. The "for" loop uses it as a counter, you see, to keep track of which iteration it's up to.