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

[Help] code error!

Started by jumpingjoran, 04 January 2013 - 03:39 AM
jumpingjoran #1
Posted 04 January 2013 - 04:39 AM
hello,

yesterday i posted a topic too.. and i have been helped and i did what they say what to do so i did that and im now back again.
there is a error in the code

it is a login system! i want to add premissions to it but dont know how can anybody help me with that?

the error is:

bios:206: [string "login.txt"]:163: '<eof>' expected


code:
http://pastebin.com/pLjDXL8i

code:
Spoiler

os.pullEvent = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
print ("			  __ |  __ |			Login System  ")
print ("				||	||	_ \\ (_-<			 ")
print ("			  __//  __// .\\___/ ___/			 ")
print ("------------------(Version: 2.1)------------------")
print ("")
print ("Login: ")
print ("")

-- admin account

write ("Username: ")
username = read()
if username == "admin" then
sleep(0.5)
write ("Password: ")
  password = read ("*")
  if password == "adminbypass" then  
  sleep(1)

function loading()
term.setCursorPos(17,11)
term.clearLine()
print ("[	Loading	]")
sleep(0,5)
term.setCursorPos(17,11)
term.clearLine()
print ("[  Loading 16%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 31%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 46%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 62%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 78%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 93%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading Done ]")
sleep(2)
end

loading()
term.setCursorPos(17,11)
term.clearLine()
print ("Account Accepted.")
sleep(3)


term.clear()
term.setCursorPos(1,1)
print ("			  __ |  __ |   Welcome, "..username.."")
print ("				||	||	_ \\ (_-<			 ")
print ("			  __//  __// .\\___/ ___/			 ")
print ("-----------------(Version: 2.1)-------------------")
print ("")
sleep(0.5)


else
loading()
sleep(2)
term.setCursorPos(11,11)
term.clearLine()
textutils.slowPrint ("Username and Password do not match")
sleep(3)
os.reboot()
end


-- jumpingjoran account

username = read()
elseif username == "jumpingjoran" then
sleep(0.5)
write ("Password: ")
  password = read ("*")
elseif password == "jumpingjoran" then  
  sleep(1)

function loading()
term.setCursorPos(17,11)
term.clearLine()
print ("[	Loading	]")
sleep(0,5)
term.setCursorPos(17,11)
term.clearLine()
print ("[  Loading 16%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 31%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 46%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 62%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 78%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 93%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading Done ]")
sleep(2)
end

loading()
term.setCursorPos(17,11)
term.clearLine()
print ("Account Accepted.")
sleep(3)

term.clear()
term.setCursorPos(1,1)
print ("			  __ |  __ |   Welcome, "..username.."")
print ("				||	||	_ \\ (_-<			 ")
print ("			  __//  __// .\\___/ ___/			 ")
print ("-----------------(Version: 2.1)-------------------")
print ("")
sleep(0.5)


else
loading()
sleep(2)
term.setCursorPos(11,11)
term.clearLine()
textutils.slowPrint ("Username and Password do not match")
sleep(3)
os.reboot()
end

-- mastermy2 account

username = read()
elseif username == "mastermy2" then
sleep(0.5)
  write ("Password: ")
  password = read ("*")
  if password == "mastermy2" then  
  sleep(1)
  function loading()
term.setCursorPos(17,11)
term.clearLine()
print ("[	Loading	]")
sleep(0,5)
term.setCursorPos(17,11)
term.clearLine()
print ("[  Loading 16%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 31%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 46%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 62%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 78%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading 93%  ]")
term.setCursorPos(17,11)
term.clearLine()
sleep(0,5)
print ("[  Loading Done ]")
sleep(2)
end

loading()
term.setCursorPos(17,11)
term.clearLine()
print ("Account Accepted.")
sleep(3)

term.clear()
term.setCursorPos(1,1)
print ("			  __ |  __ |   Welcome, "..username.."")
print ("				||	||	_ \\ (_-<			 ")
print ("			  __//  __// .\\___/ ___/			 ")
print ("-----------------(Version: 2.1)-------------------")
print ("")
sleep(0.5)


else
loading()
sleep(2)
term.setCursorPos(11,11)
term.clearLine()
textutils.slowPrint ("Username and Password do not match")
sleep(3)
os.reboot()
end


else
sleep(1)
print ("Username not found.")
sleep(1)
os.reboot()
end
jumpingjoran #2
Posted 04 January 2013 - 05:33 AM
nevermind.
got it fixed by my friend: Martin1704

http://pastebin.com/LLSB15Dx

if u want to see the script now there is the link
remiX #3
Posted 04 January 2013 - 05:40 AM
Change
 elseif password == "jumpingjoran" then   
to
 if password == "jumpingjoran" then   
Also, you do not need to define the loading() function all the time, all you need to is to define it near the beginning of the code and then call it when you need to.
jumpingjoran #4
Posted 04 January 2013 - 05:57 AM
Change
 elseif password == "jumpingjoran" then   
to
 if password == "jumpingjoran" then   
Also, you do not need to define the loading() function all the time, all you need to is to define it near the beginning of the code and then call it when you need to.

thanks i get it now!

friend of mine who his job is programming has helped me too.
this is it after he script it.
http://pastebin.com/LLSB15Dx