Edited by J-Nutz, 20 May 2014 - 03:02 PM.
0
Deleted
Started by J-Nutz, Oct 05 2013 02:13 PM
4 replies to this topic
#1
Posted 05 October 2013 - 02:13 PM
Deleted. Can't bear the noobiness that is being portrayed by my self in this post.
#2
Posted 05 October 2013 - 02:47 PM
Split into new topic.
Check out the Lua Reference Manual, the lua-users wiki, or the PIL docs to see how to actually use if statements.
Check out the Lua Reference Manual, the lua-users wiki, or the PIL docs to see how to actually use if statements.
#3
Posted 05 October 2013 - 08:13 PM
function check() --first line for i = 16, 3, -1 do turtle.compareTo(1) if = true then do turtle.dropUp() --saplings for o = 16, 5, -1 do turtle.compareTo(3) if == true do turtle.turnLeft() turtle.drop() --bonemeal for u = 14, 1, -1 do turtle.compareTo(15) if == true do turtle.turnRight() turtle.drop() --wood end end end end
You are not using if statements correctly. Instead of doing
turtle.compareTo(1) if = true then do turtle.dropUp()
You should do
if turtle.compareTo(1) then turtle.dropUp() end
#4
Posted 05 October 2013 - 08:22 PM
When comparing two things eg. function and boolean, use == to return true instead of = to set a value.
#5
Posted 05 October 2013 - 08:27 PM
more explaination:
if statements work like this
now how this works
you can also do stuff like 'not' 'or' 'and' 'else' elseif' but i recommend the reference manual or PIL
if statements work like this
if <condition> thenand for comparing to things you need '=='
if 1+1 == 2 then^ would be a valid if statement comparing 1+1 to 2 if there the same(comparison is true) continue code
now how this works
if turtle.compareTo(1) thenis turtle.compareTo(1) is a function which returns a boolean(either true or false) so if it returns true its basiclly like saying
if true thenand if the comparision is true it will continue code
you can also do stuff like 'not' 'or' 'and' 'else' elseif' but i recommend the reference manual or PIL
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users