First off I wanna say i'm not big on writing code but I wanted to make a simple program to place cake above a turtle but I cant seem to get it to work when I run the startup.
http://gyazo.com/5f6...8d9e479cdd9786a
i'm trying to get it to place cake on top of itself when it detects nothing above it any ideas or help would be appreciated
program help
Started by CLASnipe, Jul 20 2015 05:39 AM
1 reply to this topic
#1
Posted 20 July 2015 - 05:39 AM
#2
Posted 20 July 2015 - 05:52 AM
You've got a very simple problem:
When 'turtle.detectUp()' is true, that means there IS something there.
You need to invert what it returns
If you'd like it to check every few seconds, instead of just when the computer starts,
you can do this:
When 'turtle.detectUp()' is true, that means there IS something there.
You need to invert what it returns
if not turtle.detectUp() then turtle.placeUp() end
If you'd like it to check every few seconds, instead of just when the computer starts,
you can do this:
while true do --# true will always be true, so it loops forever
if not turtle.detectUp() then
turtle.placeUp()
end
sleep(5) --# Waits 5 seconds
end
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











