22 posts
Posted 07 November 2012 - 06:10 PM
print("Loading…")
write "choose Option…"
print("Empty")
print("Power")
x = Empty
y = Power
input = read()
if x == Empty then
rs.setBundledOutput( "right!, colors.lime)
input = read()
if y == Power then
rs.setBundledOutput( "right", colors.white)
sleep(1)
else
printed("incorrect answer")
sleep(2)
os.shutdown
end
help please, the message i get is the following…. bios:206: [string "bundle] :25: '=' expected
any help is appreciated ty :P/>/>
521 posts
Location
Stockholm, Sweden
Posted 07 November 2012 - 06:13 PM
os.shutdown()
You missed the brackets at the end
22 posts
Posted 07 November 2012 - 06:15 PM
Thanks, i owe you one :P/>/>
122 posts
Location
New Zealand
Posted 07 November 2012 - 06:20 PM
I cleaned up your code a little bit as well as fix it.
print("Loading...")
print("choose Option...")
print("Empty")
print("Power")
local x = Empty
local y = Power
input = read()
if input == "x" then
rs.setBundledOutput( "right", colors.lime)
elseif input == "y" then
rs.setBundledOutput( "right", colors.white)
sleep(1)
elseif input ~= "x" or "y" then
print("incorrect answer")
sleep(2)
os.shutdown()
end
The problems were that you didn't have the options in one 'if' statement. Also on os.shutdown() you forgot the (). The 2nd line also was a write command so 'Empty' was being put on the same line as choose option. Added local to your variables.
You are welcome to ask any more questions about this code.
521 posts
Location
Stockholm, Sweden
Posted 07 November 2012 - 06:37 PM
I cleaned up your code a little bit as well as fix it.
print("Loading...")
print("choose Option...")
print("Empty")
print("Power")
local x = Empty
local y = Power
input = read()
if input == "x" then
rs.setBundledOutput( "right", colors.lime)
elseif input == "y" then
rs.setBundledOutput( "right", colors.white)
sleep(1)
elseif input ~= "x" or "y" then
print("incorrect answer")
sleep(2)
os.shutdown()
end
The problems were that you didn't have the options in one 'if' statement. Also on os.shutdown() you forgot the (). The 2nd line also was a write command so 'Empty' was being put on the same line as choose option. Added local to your variables.
You are welcome to ask any more questions about this code.
You got it wrong, but the right idea.
You are checking if the input is equal to the string "x". Not the variable x.
And also you can't do
elseif input ~= x or y then
The easiest way is just to put in
else
But if you want to do it like that then you'll have to do
elseif input ~= x or input ~= y then
122 posts
Location
New Zealand
Posted 07 November 2012 - 06:40 PM
Yeah thats a mental failure on my part. Sorry haven't had much sleep and its not good to code when half asleep. xD Thanks for correcting my mistakes ^^