text.input ("Do sir want some drinks?")
variable = read()
if variable = ("yes") then
turtle.drop()
end
What am I f*cking up here?
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
bios:366: [string "turtle"]:3: 'then' excepted
Started by lare290, 12 December 2014 - 08:52 PMPosted 12 December 2014 - 09:52 PM
it says thing in title when I try to run this in turtle:
Posted 12 December 2014 - 10:09 PM
Lua doesn't expect to see a variable assignment using = there, so it complains at you. == is used for "is equal" comparisons.
Posted 12 December 2014 - 10:11 PM
now it says "bios:366: [string "turtle"]:2: '=' excepted
text.input ("Do sir want some drinks?")
variable == read()
if variable == ("yes") then
turtle.drop()
end
Edited on 12 December 2014 - 09:23 PM
Posted 12 December 2014 - 10:24 PM
Take a look at this. If you're still having trouble, post the new version of the code.
Posted 12 December 2014 - 10:47 PM
So it didn't like text.input, i had to use write for it to work. why was that?
Posted 12 December 2014 - 10:52 PM
To memory, I don't there is a text.input, at least, not unless you pre-defined one somewhere else.
Posted 12 December 2014 - 11:08 PM
I saw text.input somewhere :P/>
Posted 12 December 2014 - 11:34 PM
In if statements, it should benow it says "bios:366: [string "turtle"]:2: '=' exceptedtext.input ("Do sir want some drinks?") variable == read() if variable == ("yes") then turtle.drop() end
if variable == "yes" then
so basically, drop the parenthesis on the if statement.Edited on 12 December 2014 - 10:36 PM
Posted 13 December 2014 - 12:15 AM
print("Do sir want some drinks?")
variable = read()
if variable == ("yes") then
turtle.drop()
end
This should work. If you want to display text, use print/write/term.write
When setting a value, you need only one =
When checking if two values are the same, you need two =