Ignoring Command
#1
Posted 31 August 2013 - 05:01 AM
I was making program that can place blocks in a wall and shutdown afterwards, everything works for the first layer but the ceases after it reaches the start of the second layer where it was supposed to begin. The issue isn't shuttingdown or fuel and there is no obstructions in the way. Not sure why the second command isn't working
http://pastebin.com/VE7c4RrW
#2
Posted 31 August 2013 - 07:51 AM
#3
Posted 31 August 2013 - 08:17 AM
placeright() placeleft() if turtle.detectUp() == true then repback() --line 64 turtle.down() turtle.down() turtle.down() os.shutdown() end
On line 64, you call a function you didn't define before.
#4
Posted 31 August 2013 - 08:24 AM
http://pastebin.com/1zNGeyRe
#5
Posted 31 August 2013 - 08:28 AM
placeright() - works fine placeleft() - doesn't work at all
#6
Posted 31 August 2013 - 08:45 AM
if turtle.detect == false thenShould be:
if turtle.detect() == false then
#7
Posted 31 August 2013 - 08:47 AM
#8
Posted 31 August 2013 - 08:54 AM
just tried that and still gets stuck after the first row it makes
#9
Posted 31 August 2013 - 08:55 AM
Just tested it without line 13, that part wasn't necessary
Edited by Doomerzzzz, 31 August 2013 - 09:03 AM.
#10
Posted 31 August 2013 - 09:04 AM
for slot = 2, 16 do
does. As I inderstand it "slot" will be initialized to 2 on its first run, if "break" isn't encountered, it'll iterate all the way to 16 which is the second parameter passed to "for". The lines 12, 13, and 14 have no effect on this line.
I am thinking that you want it to somehow remember where it was in the loop when break was encountered. In which case you'll need a global variable call it lastSlot for instance.
so at the top of your program you would have
lastSlot = 2and then in your loop declaration it would look like
for slot = lastSlot, 16 doand right before the "break" command you would have
lastSlot = slot+1and finally I believe the lines 12, 13 & 14 were meant to check that "slot" wasn't outside of the range 2::16 so they need to be adjusted for lastSlot. The result possibly being
if lastSlot > 16 then lastSlot = 2 end
#11
Posted 31 August 2013 - 09:11 AM
lines 12, 13 and 14 wasn't needed, I'm relatively new to lua, only had started a not long ago, sorry.
that part is fixed up now.
well for now line 15 would be enough for what I need it to do right now, but I'll write that one down for future reference.
for slot = 2, 16 do
#12
Posted 31 August 2013 - 09:19 AM
#13
Posted 31 August 2013 - 09:24 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users