This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
BigMomma's profile picture

Computercraft expecting an '=' in line 37

Started by BigMomma, 17 September 2014 - 10:08 AM
BigMomma #1
Posted 17 September 2014 - 12:08 PM
Hi,

I'm trying to code an automatic cooling system for my reactor, when you type 'on' in the terminal redstone will turn on the system or off will do the opposite.

I wanted the terminal to always display a main page, welcoming them to the terminal and therefore the code is quite large as whenever a command is entered such as on, I had the terminal write Turning on… the script sleeps for a few seconds then the terminal will clear and re-write the welcome page.

Can you please try however to debug what's wrong. The error is happening on line 37, where I set the cursor pos.


local monitor = peripheral.wrap("top")
while true do
monitor.clear()
monitor.setCursorPos(8,4)
monitor.write("Cooling System:")
monitor.setCursorPos(13,8)
monitor.write("OFF")
term.clear()
term.setCursorPos(7,3)
term.write("===================================")
term.setCursorPos(13,4)
term.write("Cooling System Controls.")
term.setCursorPos(7,5)
term.write("===================================")
term.setCursorPos(1,9)
term.write("To control the cooling system, please type either")
term.setCursorPos(1,10)
term.write("'OFF' or 'ON'. For the current status of the")
term.setCursorPos(1,11)
term.write("cooling system see monitor above. When turning on")
term.setCursorPos(1,12)
term.write("the cooling system please allow 1 minute before")
term.setCursorPos(13,13)
term.write("system is fully cooled.")
term.setCursorPos(1,15)
if input == "on" then
redstone.setOutput("back", true)
monitor.clear()
monitor.setCursorPos(8,4)
monitor.write("Cooling System:")
monitor.setCursorPos(13,8)
monitor.write("ON")
term.setCursorPos(1,17)
term.write("Turning Cooling System On...")
sleep(3)
term.clear
term.setCursorPos(7,3)
term.write("===================================")
term.setCursorPos(13,4)
term.write("Cooling System Controls.")
term.setCursorPos(7,5)
term.write("===================================")
term.setCursorPos(1,9)
term.write("To control the cooling system, please type either")
term.setCursorPos(1,10)
term.write("'OFF' or 'ON'. For the current status of the")
term.setCursorPos(1,11)
term.write("cooling system see monitor above. When turning on")
term.setCursorPos(1,12)
term.write("the cooling system please allow 1 minute before")
term.setCursorPos(13,13)
term.write("system is fully cooled.")
term.setCursorPos(1,15)
else if input == "off" then
redstone.setOutput("back", false)
monitor.clear()
monitor.setCursorPos(8,4)
monitor.write("Cooling System:")
monitor.setCursorPos(13,8)
monitor.write("OFF")
term.setCursorPos(1,17)
term.write("Turning Cooling System Off...")
sleep(3)
term.clear
term.setCursorPos(7,3)
term.write("===================================")
term.setCursorPos(13,4)
term.write("Cooling System Controls.")
term.setCursorPos(7,5)
term.write("===================================")
term.setCursorPos(1,9)
term.write("To control the cooling system, please type either")
term.setCursorPos(1,10)
term.write("'OFF' or 'ON'. For the current status of the")
term.setCursorPos(1,11)
term.write("cooling system see monitor above. When turning on")
term.setCursorPos(1,12)
term.write("the cooling system please allow 1 minute before")
term.setCursorPos(13,13)
term.write("system is fully cooled.")
term.setCursorPos(1,15)
else
term.setCursorPos("1,17)
term.write("Command not recognised...")
sleep(3)
term.clear
term.setCursorPos(7,3)
term.write("===================================")
term.setCursorPos(13,4)
term.write("Cooling System Controls.")
term.setCursorPos(7,5)
term.write("===================================")
term.setCursorPos(1,9)
term.write("To control the cooling system, please type either")
term.setCursorPos(1,10)
term.write("'OFF' or 'ON'. For the current status of the")
term.setCursorPos(1,11)
term.write("cooling system see monitor above. When turning on")
term.setCursorPos(1,12)
term.write("the cooling system please allow 1 minute before")
term.setCursorPos(13,13)
term.write("system is fully cooled.")
term.setCursorPos(1,15)
end
end
end
Bomb Bloke #2
Posted 17 September 2014 - 01:17 PM
Take a look here, it should help you out. :)/>
Anavrins #3
Posted 17 September 2014 - 03:45 PM
You have an extra " on that line
term.setCursorPos("1,17)
Edited on 17 September 2014 - 01:45 PM
Dragon53535 #4
Posted 17 September 2014 - 05:19 PM
Your error is actually on line 36 term.clear should be term.clear() as well as line 64 and the error that anavrins stated is on line 83 Also, delete one of your ends
Edited on 17 September 2014 - 03:41 PM
KingofGamesYami #5
Posted 17 September 2014 - 06:19 PM
To add to what Dragon said, this line:

else if input == "off" then
should be

elseif input == "off" then
Gumball #6
Posted 17 September 2014 - 10:30 PM
goto here to get the code I made for this :)/> it even uses buttons :D/>

http://pastebin.com/JUuwTiDp