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

Ignoring Conditional

Started by 119michael911, 31 August 2013 - 12:56 AM
119michael911 #1
Posted 31 August 2013 - 02:56 AM
Title: Ignoring Conditional
I was making a quarry program and after it does one layer i want it to go down and i have a conditional to check for that, but it seems to be ignoring it, i don't know why it is doing that, maybe one of you guys can figure that out for me. thanks in advance
http://pastebin.com/tLNdmWbt
Bubba #2
Posted 31 August 2013 - 08:50 AM
Split into new topic.
floppyjack #3
Posted 31 August 2013 - 09:25 AM
I suppose the conditional that doesn't work is this one:

if p == i then
The variable i is nil at this point of the program, it only has a value inside the for-loop.
After that, it has the value it has before the loop, which is nil.
119michael911 #4
Posted 31 August 2013 - 02:39 PM
I suppose the conditional that doesn't work is this one:

if p == i then
The variable i is nil at this point of the program, it only has a value inside the for-loop.
After that, it has the value it has before the loop, which is nil.
ok i see but when i change it to this http://pastebin.com/UrFVzrG4
the turtle isnt crashing but it is not going down but instead is continuing the quarry but sideways.
btw p == i didnt work because the moment it starts it will be true because 1 == 1.
CCJJSax #5
Posted 31 August 2013 - 03:28 PM
I suppose the conditional that doesn't work is this one:

if p == i then
The variable i is nil at this point of the program, it only has a value inside the for-loop.
After that, it has the value it has before the loop, which is nil.
ok i see but when i change it to this http://pastebin.com/UrFVzrG4
the turtle isnt crashing but it is not going down but instead is continuing the quarry but sideways.
btw p == i didnt work because the moment it starts it will be true because 1 == 1.

Just a guess, but try doing this on line 15



if (p + i) == (tArgs[1] + tArgs[2] - 1) then


hopefully the issue was that it wasn't doing the math on each side at the same time or something.