Jump to content




Computercraft expecting an '=' in line 37


  • You cannot reply to this topic
5 replies to this topic

#1 BigMomma

  • New Members
  • 1 posts

Posted 17 September 2014 - 11:08 AM

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


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 17 September 2014 - 12:17 PM

Take a look here, it should help you out. :)

#3 Anavrins

  • Members
  • 775 posts

Posted 17 September 2014 - 02:45 PM

You have an extra " on that line
term.setCursorPos("1,17)

Edited by Anavrins, 17 September 2014 - 02:45 PM.


#4 Dragon53535

  • Members
  • 973 posts
  • LocationIn the Matrix

Posted 17 September 2014 - 04: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 by Dragon53535, 17 September 2014 - 04:41 PM.


#5 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 17 September 2014 - 05:19 PM

To add to what Dragon said, this line:
else if input == "off" then
should be
elseif input == "off" then


#6 Gumball

  • Members
  • 254 posts
  • LocationFairbanks, Alaska

Posted 17 September 2014 - 09:30 PM

goto here to get the code I made for this :) it even uses buttons :D

http://pastebin.com/JUuwTiDp





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users