Jump to content




Ignoring Conditional


4 replies to this topic

#1 119michael911

  • New Members
  • 2 posts

Posted 31 August 2013 - 01: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

#2 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 31 August 2013 - 07:50 AM

Split into new topic.

#3 floppyjack

  • Members
  • 18 posts

Posted 31 August 2013 - 08: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.

#4 119michael911

  • New Members
  • 2 posts

Posted 31 August 2013 - 01:39 PM

View Postfloppyjack, on 31 August 2013 - 08:25 AM, said:

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.

#5 CCJJSax

  • Members
  • 262 posts

Posted 31 August 2013 - 02:28 PM

View Post119michael911, on 31 August 2013 - 01:39 PM, said:

View Postfloppyjack, on 31 August 2013 - 08:25 AM, said:

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users