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

Startup Interface Error

Started by ShadowFireE397, 25 August 2012 - 07:05 AM
ShadowFireE397 #1
Posted 25 August 2012 - 09:05 AM
I have found a program on youtube and modified it slightly for my needs, but when its starts it has this error:

bios:206: [string "startup"]:25: unexpected symbol

I have tried to figure out the problem by myself but cant find the error. The code is below, if you can correct me it would be greatly appreciated:
N.B. I am running Tekkit for 1.3.1 with ComputerCraft 1.3

while true do
term.clear()
term.setCursorPos(1,2)
print" ———————————————- "
print" | |"
print" | Cryo Chamber Crontrol |"
print" | |"
print" ———————————————- "
print" "
print" "
print" "
print" Insert Command: "
term.setCursorPos(29,10)
input = io.read()
term.setCursorPos(1,2)
print" ———————————————- "
print" | |"
print" | Cryo Chamber Crontrol |"
print" | |"
print" ———————————————- "
print" "
print" "
print" "
print" "
if input == "Activate" or input == "activate" or input == "ACTIVATE" then
if rs.getOutput("back") == true then
term.setCursorPos(17,10)
print("Cryo Chamber Already Active")
else
rs.setOutput("back", true)
term.setCursorPos(17,10)
print("Cryo Chamber Now Active")
end
else
if input == "Deactivate" or input == "deactivate" or input == "DEACTIVATE" then
if rs.getOutput("back") == false then
term.setCursorPos(17,10)
print("Cryo Chamber Already Deactive")
else
rs.setOutput("back", false)
term.setCursorPos(17,10)
print("Cryo Chamber Now Deactive")
end
else
term.setCursorPos(17,10)
print("Command not Recognized")
end
sleep(3)
end

As I said any help would be greatly appreciated, so thanks in advance.
ardera #2
Posted 25 August 2012 - 09:48 AM
Here is a bit formatted and fixed code (if its not formatted for you, its the forum…):

while true do
  function printCCC(n)
local function p()
	term.setCursorPos(1,2)
	print(" ---------------------------------------------- ")
	print(" |  |")
	print(" |  Cryo Chamber Crontrol  |")
	print(" |  |")
	print(" ---------------------------------------------- ")
	print("")
	print("")
	print("")
end
if n==1 then
   term.clear()
   p()
	  print("	 Insert Command:	 ")
elseif n==2 then
   p()
   print("")
end
  end
  printCCC(1)
  term.setCursorPos(29,10)
  input = read()
  printCCC(2)
  if string.upper(input)=="ACTIVATE" then
	if rs.getOutput("back") == true then
	  term.setCursorPos(17,10)
	  print("Cryo Chamber Already Active")
	else
	  rs.setOutput("back", true)
	  term.setCursorPos(17,10)
	  print("Cryo Chamber Now Active")
	end
  elseif string.upper(input)=="DEACTIVATE" then
	if rs.getOutput("back") == false then
	  term.setCursorPos(17,10)
	  print("Cryo Chamber Already Deactive")
	else
	  rs.setOutput("back", false)
	  term.setCursorPos(17,10)
	  print("Cryo Chamber Now Deactive")
	end
  else
	term.setCursorPos(17,10)
	print("Command not Recognized")
  end
  sleep(3)
end

Should work…
You can use string.upper(aString) to make a non-case-sensitive user input detection,
string.upper("HeLlO") will be "HELLO"

You can use elseif to make an else and an if in one keyword…

Sorry for the bad English, Im from Germany…
ShadowFireE397 #3
Posted 26 August 2012 - 03:35 AM
Thank you so much, but do you know if i can copy and paste that into the console in game or do i just have to re-type it manually. Thanks for all your help.