15 posts
Posted 20 January 2013 - 12:30 PM
local engines = false
print("engines on or off?")
question == io.read()
while true do
if question == on then
engines = true
term.clear()
break
else
if question == off then
engines = false
term.clear()
break
else
print("You need to say ON or OFF!")
end
end
end
edit: this is the error:
bios:388: [string "engines"] :4: '=' expected
1852 posts
Location
Sweden
Posted 20 January 2013 - 12:32 PM
Well first off all print Your error,
And You need to call on and off as strings like this:
"on"
"off"
7508 posts
Location
Australia
Posted 20 January 2013 - 12:35 PM
Please don't double post, it won't get you help any quicker… I have answered your question in the other topic you posted it…
Also this IS the correct place to post issues like this… not in "Programs" that area is for completed code…
Edited on 20 January 2013 - 11:36 AM
1852 posts
Location
Sweden
Posted 20 January 2013 - 01:15 PM
Please don't double post, it won't get you help any quicker… I have answered your question in the other topic you posted it…
Also this IS the correct place to post issues like this… not in "Programs" that area is for completed code…
You mean that he posted like the exactly same thing before?
7508 posts
Location
Australia
Posted 20 January 2013 - 01:17 PM
Please don't double post, it won't get you help any quicker… I have answered your question in the other topic you posted it…
Also this IS the correct place to post issues like this… not in "Programs" that area is for completed code…
You mean that he posted like the exactly same thing before?
He posted it here
http://www.computercraft.info/forums2/index.php?/topic/9533-what-is-wrong-need-help/
2005 posts
Posted 20 January 2013 - 05:48 PM
Generally, you want to tell us what is wrong with the code…what happens when you run it that differs from what you thought would happen (often this include the issuance of an error message).
We then are able to tell you why it is wrong, and perhaps how to fix it to do what you want.
In this case, with the information given, I'm going to say that there is nothing wrong with this code :)/>
15 posts
Posted 20 January 2013 - 11:31 PM
this is the error:
bios:388: [string "engines"] :4: '=' expected
318 posts
Location
Somewhere on the planet called earth
Posted 20 January 2013 - 11:45 PM
You set a variable with = and compare to values with ==.
Line 4 should be question = io.read()
15 posts
Posted 21 January 2013 - 11:19 AM
You set a variable with = and compare to values with ==.
Line 4 should be question = io.read()
ooh jeah i am stupid that i dont saw that thank you very much :)/>
7508 posts
Location
Australia
Posted 21 January 2013 - 12:01 PM
Line 4 should be question = io.read()
Doesn't need to be… read() does the same…
2088 posts
Location
South Africa
Posted 21 January 2013 - 06:17 PM
Line 4 should be question = io.read()
Doesn't need to be… read() does the same…
Yeah but he has question == io.read()
2005 posts
Posted 21 January 2013 - 10:07 PM
Of course, we're moving towards the much worse behavior of continuously printing "You need to say ON or OFF!" until the computer is stopped for failure to yield.
But hey, maybe that's intentional? ;)/>
2088 posts
Location
South Africa
Posted 22 January 2013 - 01:22 AM
Of course, we're moving towards the much worse behavior of continuously printing "You need to say ON or OFF!" until the computer is stopped for failure to yield.
But hey, maybe that's intentional? ;)/>
Haha, only saw that now. It's hard to see if you're not really concentrating because of no code tags or indentation :P/>