Posted 22 September 2012 - 02:22 PM
Hey!
i've tried to make a Login + Menu system, but it still just says "Startup:33: Attempt to call nil"
i'd want that if i selected
+———————+
+ [ Login ] + <- this function, then it will go directly to the Login function, i'd made too. but it crashed in this string
+———————+
+ Exit +
+———————+
+————————–+
+ Enter Password +
+————————–+
Can someone please help me?
i've tried to make a Login + Menu system, but it still just says "Startup:33: Attempt to call nil"
i'd want that if i selected
+———————+
+ [ Login ] + <- this function, then it will go directly to the Login function, i'd made too. but it crashed in this string
+———————+
+ Exit +
+———————+
+————————–+
+ Enter Password +
+————————–+
Can someone please help me?
Spoiler
sid = 0
function menu(id, text)
if sid == id then
write"> "
elseif sid == 1 then
write""
end
print(text)
end
while true do
term.clear()
term.setCursorPos(2,1)
menu(0, "Login")
term.setCursorPos(2,2)
menu(1, "Exit")
event, key = os.pullEvent("key")
if key == 200 then
if sid > 0 then
sid = sid - 1
end
elseif key == 208 then
if sid < 1 then
sid = sid + 1
end
elseif key == 28 then
if sid == 0 then
Logg1() <<------ Here it did say the Error.
elseif sid == 0 then
return false
elseif sid == 1 then
os.shutdown()
end
return false
end
end
function Logg1()
term.clear()
term.setCursorPos(1,1)
print("+-------------------------+")
print("+ Enter Password! +")
print("+-------------------------+")
term.setCursorPos(3,2)
password = io.read("#")
if password == "ShutUp" then
print("Acces Granted")
sleep(4)
os.shutdown()
else
print("Acces Denied!")
sleep(2)
os.shutdown()
end
end
--[[####################################]]--
--[[#Dont Take Care of my Jail System, Please!#]]--
--[[###################################################]]--
--[[#You May edit it, but this code for the Jail isn't doing any Error!#]]--
--[[###################################################]]--
--[[# Yet #]]--
--[[######]]--
function Clear(arg1,arg2)
term.clear()
term.setCursorPos(arg1,arg2)
end
Clear(1,1)
checkDoors()
door1 = 0
door2 = 0
door3 = 0
door4 = 0
door5 = 0
door6 = 0
door7 = 0
door8 = 0
door9 = 0
door10 = 0
door11 = 0
door12 = 0
close1 = "!"
open1 = "-"
function checkDoors()
if door1 == 0 then
check1 = "-"
else
check1 = "!"
end
if door2 == 0 then
check2 = "-"
else
check2 = "!"
end
if door3 == 0 then
check3 = "-"
else
check3 = "!"
end
if door4 == 0 then
check4 = "-"
else
check4 = "!"
end
if door5 == 0 then
check5 = "-"
else
check5 = "!"
end
if door6 == 0 then
check6 = "-"
else
check6 = "!"
end
if door7 == 0 then
check7 = "-"
else
check7 = "!"
end
if door8 == 0 then
check8 = "-"
else
check8 = "!"
end
if door9 == 0 then
check9 = "-"
else
check9 = "!"
end
if door10 == 0 then
check10 = "-"
else
check10 = "!"
end
if door11 == 0 then
check11 = "-"
else
check11 = "!"
end
if door12 == 0 then
check12 = "-"
else
check12 = "!"
end
end
print(" +---+---+---+---+---+---+---+---+---+---+---+--+")
print(" + 1 ! 2 ! 3 ! 4 ! 5 ! 6 ! 7 ! 8 ! 9 !10 !11 !12+")
print(" +-"..check1.."-+-"..check2.."-+-"..check3.."-+-"..check4.."-+-"..check5.."-+-"..check6.."-+-"..check7.."-+-"..check8.."-+-"..check9.."-+-"..check10.."-+-"..check11.."-+-"..check12.."+")
print("")
print("")
print(" +----------------------------------------------+")
print(" + Log-In to edit Jail Options! : Login / Exit +")
print(" +----------------------------------------------+")