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

bios: 206: [string "Reactor"]:130: unexpected symbol

Started by flaminsnowman99, 13 July 2012 - 04:14 PM
flaminsnowman99 #1
Posted 13 July 2012 - 06:14 PM
So I was working on coding my reactor and I got this strange error. Im not quite sure what it means. Heres the code.

local function warningMenu()
while true do
  term.clear()
  term.setCursorPos(1,1)
  print("***************************")
  print("Early Warning Menu")
  print("1. Dangerous Things")
  print("2. What You Dont Want To See")
  print("3. How To Prevent Disaster")
  print("4. Back")
  e, p = os.pullEvent()
  if e == "char" then
   if p == "1" then
    term.clear()
    term.setCursorPos(1,1)
    print("Dangerous Things")
    sleep(2)
    print()
    print("1. Weapons And Sharp Objects")
    sleep(2)
    print("2. Fire and lava")
    sleep(2)
    print("3. Lasers")
    sleep(2)
    return
   if p == "2" then --This is line 130
    term.clear
    term.setCursorPos(1,1)
    print("What You Dont Want To See")
    sleep(2)
    print()
    print("1. Fire")
    sleep(2)
    print("2. Lava")
    sleep(2)
    print("3. Orange Flashing Lights")
    sleep(2)
    print("4. Red Lights")
    sleep(2)
    print("If any of these are seen, please contact an")
    print("administrator immediatly. These signs also")
    print("mean you are probably going to die. A generic")
    print("I Love You note will be sent to your family.")
    print("Thank you for working for us here at SnowMan HQ.")
    sleep(7)
    return
   if p == "3" then
    term.clear()
    term.setCursorPos(1,1)
    print("How To Prevent Disaster")
    sleep(2)
    print()
    print("1. Seeing as systems here are automated, just")
    print("dont touch any wires and everything should be")
    print("okay. Hopefully.")
    sleep(2)
    print("2. Common Sense Helps Some too.")
   if p == "4" then
    return
   end
  end
end
end
I commented line 130. Anyone know what the problem is?
KevinW1998 #2
Posted 13 July 2012 - 06:26 PM
you have fogotten to "end" the ifs

local function warningMenu()
while true do
  term.clear()
  term.setCursorPos(1,1)
  print("***************************")
  print("Early Warning Menu")
  print("1. Dangerous Things")
  print("2. What You Dont Want To See")
  print("3. How To Prevent Disaster")
  print("4. Back")
  e, p = os.pullEvent()
  if e == "char" then
   if p == "1" then
    term.clear()
    term.setCursorPos(1,1)
    print("Dangerous Things")
    sleep(2)
    print()
    print("1. Weapons And Sharp Objects")
    sleep(2)
    print("2. Fire and lava")
    sleep(2)
    print("3. Lasers")
    sleep(2)
    return
   end
   if p == "2" then --This is line 130
    term.clear
    term.setCursorPos(1,1)
    print("What You Dont Want To See")
    sleep(2)
    print()
    print("1. Fire")
    sleep(2)
    print("2. Lava")
    sleep(2)
    print("3. Orange Flashing Lights")
    sleep(2)
    print("4. Red Lights")
    sleep(2)
    print("If any of these are seen, please contact an")
    print("administrator immediatly. These signs also")
    print("mean you are probably going to die. A generic")
    print("I Love You note will be sent to your family.")
    print("Thank you for working for us here at SnowMan HQ.")
    sleep(7)
    return
   end
   if p == "3" then
    term.clear()
    term.setCursorPos(1,1)
    print("How To Prevent Disaster")
    sleep(2)
    print()
    print("1. Seeing as systems here are automated, just")
    print("dont touch any wires and everything should be")
    print("okay. Hopefully.")
    sleep(2)
    print("2. Common Sense Helps Some too.")
   end
   if p == "4" then
    return
   end
  end
end
end
Lyqyd #3
Posted 13 July 2012 - 06:48 PM
Those really should be elseif blocks rather than distinct if blocks.
flaminsnowman99 #4
Posted 13 July 2012 - 06:51 PM
Thats the problem! Wow, thank you. I feel stupid though :)/>/>