17 posts
Posted 31 March 2015 - 03:19 PM
I just made a program designed to monitor the temperatures of a nuclear reactor and it coming up with the error in the title and apparently it's on line 8 however, I can't see what's wrong. I know what the error code means but I can't find it. Help!
The code goes like this (I may have made errors while typing it up so I recommend you use the screen shot instead):
term.clear()
print("Reactor heat monitor and control.")
sleep(3)
term.clear()
password = read()
while true do
if rs.testBundledInput("back", colour.red) then
print("Reactor temperature is at 500C.")
sleep(5)
os.reboot()
else
os.reboot()
end
There is more code obviously but this is the bit where the error is coming up.
Thanks for the help!
Here's a screenshot of the exact code.
[attachment=2180:Screenshot (12).png]
Edited on 31 March 2015 - 01:20 PM
3057 posts
Location
United States of America
Posted 31 March 2015 - 03:20 PM
Change colour to colours on line 7. Alternatively, the US spelling is 'colors'.
Edit: Also, you are missing an end to your while loop.
Edited on 31 March 2015 - 01:22 PM
2427 posts
Location
UK
Posted 31 March 2015 - 03:21 PM
indent your code, it helps find problems like this
edit: just noticed that you said that this is a snippet
term.clear()
print("Reactor heat monitor and control.")
sleep(3)
term.clear()
password = read()
while true do
if rs.testBundledInput("back", colours.red) then --#this was colour.red
print("Reactor temperature is at 500C.")
sleep(5)
os.reboot()
else
os.reboot()
end
--#you are missing an end here, this may be because of the snippet thing
Edited on 31 March 2015 - 01:23 PM
17 posts
Posted 31 March 2015 - 03:23 PM
I'll try it.
indent your code, it helps find problems like this
edit: just noticed that you said that this is a snippet
term.clear()
print("Reactor heat monitor and control.")
sleep(3)
term.clear()
password = read()
while true do
if rs.testBundledInput("back", colour[u]s[/u].red) then
print("Reactor temperature is at 500C.")
sleep(5)
os.reboot()
else
os.reboot()
end
--#you are missing an end here
That's not all the code there's a lot more after it so i put the end in just further down.
Edited on 31 March 2015 - 01:29 PM
17 posts
Posted 31 March 2015 - 03:28 PM
Change colour to colours on line 7. Alternatively, the US spelling is 'colors'.
Edit: Also, you are missing an end to your while loop.
Thanks this fixed it!
1847 posts
Location
/home/dannysmc95
Posted 31 March 2015 - 04:14 PM
indent your code, it helps find problems like this
edit: just noticed that you said that this is a snippet
term.clear()
print("Reactor heat monitor and control.")
sleep(3)
term.clear()
password = read()
while true do
if rs.testBundledInput("back", colours.red) then --#this was colour.red
print("Reactor temperature is at 500C.")
sleep(5)
os.reboot()
else
os.reboot()
end
--#you are missing an end here, this may be because of the snippet thing
Even if they indent code for some reason if you are using sublime it doesn't always indent the code…on these forums…
1140 posts
Location
Kaunas, Lithuania
Posted 31 March 2015 - 04:42 PM
The editor on these forums is really buggy. But, there is a 'Toggle Edit Mode' button on the top-left corner of the editor which turns off all the fancy edit parts, so, although you have to type every tag manually, it is way easier to write the post in that mode. It doesn't mess with any pasted-code indentation or any other formatting, that's why I use it all the time.
1847 posts
Location
/home/dannysmc95
Posted 31 March 2015 - 04:56 PM
The editor on these forums is really buggy. But, there is a 'Toggle Edit Mode' button on the top-left corner of the editor which turns off all the fancy edit parts, so, although you have to type every tag manually, it is way easier to write the post in that mode. It doesn't mess with any pasted-code indentation or any other formatting, that's why I use it all the time.
Didn't know that!!