6 posts
Posted 27 August 2017 - 02:26 PM
Hello i have an problem with
my Programm, i wanted the programm to say "finally it done" if the turtle detect a Block in front, but the turtle says always "finally it done"
Edited on 28 August 2017 - 01:22 AM
7083 posts
Location
Tasmania (AU)
Posted 27 August 2017 - 02:46 PM
"x" is a global variable, and (prior to 1.80) ComputerCraft doesn't clear your globals when your scripts end. This means that once "x" is set to 5 it'll stay that way until the turtle reboots. See
this tutorial for more information about locals, globals, and scope.
Adding "local x" as the first line of your script should fix it.