Jump to content




Why is this error popping up?


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

#1 MoRBiiD Legacy

  • Members
  • 13 posts

Posted 09 April 2015 - 08:56 PM

I am trying to make a startup code for a multi function defence system, which i have not finished, but every time i try to launch it on my advanced terminal, i get <eof> error on line 46... why?

shell.run("clear")
print("Welcome to MoRBiiD's cannon control terminal!")
sleep(5)
print("What is your command?")
print("arm, deactivate") -- No deactivation yet...
local input = read()
if (input) == ("arm") then
shell.run("clear")
print("Loading...")
sleep(2)
shell.run("clear")
print("Fire, arrow or tnt?") -- No TNT yet...
local input = read()
if (input) == ("fire") then
shell.run("clear")
print(".")
sleep(1)
shell.run("clear")
print("..")
sleep(1)
shell.run("clear")
print("...")
sleep(1)
shell.run("clear")
redstone.setBundledOutput("back", colors.red)
sleep(1)
redstone.setBundledOutput("back", 0)
print("Done.")
end
elseif (input) == ("arrow") then
shell.run("clear")
print(".")
sleep(1)
shell.run("clear")
print("..")
sleep(1)
shell.run("clear")
print("...")
sleep(1)
shell.run("clear")
redstone.setBundledOutput("back", colors.white)
sleep(1)
redstone.setBundledOutput("back", 0)
print("Done.")
end
end -- <eof> expected?
sleep(2)
shell.run("startup")

#2 KingofGamesYami

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

Posted 09 April 2015 - 09:00 PM

<eof> expected means you have too many ends somewhere in your code. Proper indentation can reveal this:

shell.run("clear")
print("Welcome to MoRBiiD's cannon control terminal!")
sleep(5)
print("What is your command?")
print("arm, deactivate") -- No deactivation yet...
local input = read()
if (input) == ("arm") then 
  shell.run("clear") 
  print("Loading...") 
  sleep(2) 
  shell.run("clear") 
  print("Fire, arrow or tnt?") -- No TNT yet...
  local input = read()
  if (input) == ("fire") then
    shell.run("clear")
    print(".")
    sleep(1)
    shell.run("clear")
    print("..")
    sleep(1)
    shell.run("clear")
    print("...")
    sleep(1)
    shell.run("clear")
    redstone.setBundledOutput("back", colors.red)
    sleep(1)
    redstone.setBundledOutput("back", 0)
    print("Done.")
  end --#here
  elseif (input) == ("arrow") then
    shell.run("clear")
    print(".")
    sleep(1)
    shell.run("clear")
    print("..")
    sleep(1)
    shell.run("clear")
    print("...")
    sleep(1)
    shell.run("clear")
    redstone.setBundledOutput("back", colors.white)
    sleep(1)
    redstone.setBundledOutput("back", 0)
    print("Done.")
  end
end -- <eof> expected?
sleep(2)
shell.run("startup") 

Also, I'd take a look at textutils.slowPrint ;)

#3 MoRBiiD Legacy

  • Members
  • 13 posts

Posted 09 April 2015 - 09:07 PM

View PostKingofGamesYami, on 09 April 2015 - 09:00 PM, said:

<eof> expected means you have too many ends somewhere in your code. Proper indentation can reveal this:

shell.run("clear")
print("Welcome to MoRBiiD's cannon control terminal!")
sleep(5)
print("What is your command?")
print("arm, deactivate") -- No deactivation yet...
local input = read()
if (input) == ("arm") then
  shell.run("clear")
  print("Loading...")
  sleep(2)
  shell.run("clear")
  print("Fire, arrow or tnt?") -- No TNT yet...
  local input = read()
  if (input) == ("fire") then
	shell.run("clear")
	print(".")
	sleep(1)
	shell.run("clear")
	print("..")
	sleep(1)
	shell.run("clear")
	print("...")
	sleep(1)
	shell.run("clear")
	redstone.setBundledOutput("back", colors.red)
	sleep(1)
	redstone.setBundledOutput("back", 0)
	print("Done.")
  end --#here
  elseif (input) == ("arrow") then
	shell.run("clear")
	print(".")
	sleep(1)
	shell.run("clear")
	print("..")
	sleep(1)
	shell.run("clear")
	print("...")
	sleep(1)
	shell.run("clear")
	redstone.setBundledOutput("back", colors.white)
	sleep(1)
	redstone.setBundledOutput("back", 0)
	print("Done.")
  end
end -- <eof> expected?
sleep(2)
shell.run("startup")

Also, I'd take a look at textutils.slowPrint ;)

thx it worked! i didnt think the problem was that i had too many "end"s but that i needed another (end of function EXPECTED) Now to blow up my friend's house > :D and btw i never thought that any slow print was possible, so thats why there are so many print>sleep>clear mini functions, thx for the advice!

Edited by GAMR DUD3, 09 April 2015 - 09:12 PM.


#4 KingofGamesYami

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

Posted 09 April 2015 - 10:27 PM

eof stands for end of file (if there are too many ends, it'll do something like '<eof> expected').

Edited by KingofGamesYami, 09 April 2015 - 10:28 PM.






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users