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

[Programming] [menu] [jail-system] [startup4:70: attempt to compare nil"] HELP!

Started by Goof, 24 September 2012 - 06:50 PM
Goof #1
Posted 24 September 2012 - 08:50 PM
Hey…. i have a litlle( or maybe a big problem/error for me) error, in my HUGE Code here:


When i try to start my function "menu2edit(arg1,arg2)" (with a "Select-an-option" method in(will be showed)) but when my program reach a part of the code, then it says:
startup4:70: attempt to get 'length' of nil"

eehhm… a 'length' of a nil? what is that..

please explain it, if you can.
also if u can solve the problem in my code, then You will be my hero.

i'm so unhappy that after 2 x 24 hours programming, then it does not work with this little part!
omg!

"Select-An-Option" method:

1 [ Door1 ] <— Moveable with Arrow keys.
2 Door2
3 Door3
4 Door4

etc.






My Code is here:

—- WARNING —-
THIS CODE IS ENORMOUS! BUT WHEN U OPEN IT, PLEASE FIND THE MARKERS I DID MAKE IN THE CODE, and try to solve the problem,
PLEASE!


Spoilerare you sure you want me to show you my code?

YES!
Spoiler



   ---[[ SECTION: VARIABLES

D1 = "-"
D2 = "-"
D3 = "-"
D4 = "-"
D5 = "-"
D6 = "-"
D7 = "-"
D8 = "-"
D9 = "-"
DX1 = "!"
DX2 = "!"
loop1 = true
loop2 = false
loop3 = false
loop4 = 1
loop5 = 1
loop6 = 1
loopJail = false
loopJail1 = false
loopJail2 = false
loopLogin1 = false
loopLogin2 = false
loopSelector = false
loopSelector1 = false
loopSelector2 = false
loopSelector3 = false
OptionC = 0
OptionB = 0
Line1 = 0
Line2 = 0
Line3 = 0
Line4 = 0
BootLoop0 = false
BootLoop1 = true

---]] SECTION: VARIABLES

---[[ SECTION: MENU

function menu1(id, text)
if Line1 == id then
write"-> "
elseif Line1 == 1 then
write" "
end
print(text)
end

function menu2(id, text)
if Line2 == id then
write"-> "
elseif Line2 == 1 then
write" "
elseif Line2 == 2 then
write" "
end
print(text)
end






function menu2edit(arg1, arg2)  ---[[ FAIL IN THIS FUNCTION...  ]]---
loopCuI = true
function CUI(m)
h=1
l=#m <------ [[ "startup4:70: attempt to get 'length' of nil" ]] ----------
while loopCuI do
term.clear()
term.setCursorPos(arg1,arg2)

for i=1, l, 1 do
if i==h then print(i, " ["..m[i].."]") else print(i, " ", m[i]) end
end
a, b= os.pullEventRaw()
if a == "key" then
if b==200 and h>1 then
h=h-1
end
if b==208 and h<l then
h=h+1
end
if b==28 then


if h==1 then
loop3 = true



while loop3 do



--[[menus]]--

menu3edit(1, 4, 1, 4)

--[[MENUS]]--



event, key = os.pullEvent("key")
if key == 200 then
if Line3 > 0 then
Line3 = Line3 - 1
end
elseif key == 208 then
if Line3 < 1 then
Line3 = Line3 + 1
end
elseif key == 28 then
if Line3 == 0 then
loop3 = false

end

elseif Line3 == 1 then
loop3 = false

elseif Line3 == 2 then
loop3 = false

elseif Line3 == 3 then
loop3 = false

elseif Line3 == 4 then
loop3 = false

elseif Line3 == 5 then
loop3 = false

elseif Line3 == 6 then
loop3 = false

elseif Line3 == 7 then
loop3 = false

elseif Line3 == 8 then
loop3 = false

elseif Line3 == 9 then
loop3 = false



break
end


loop3 = true

end
end
elseif h==2 then
os.shutdown()
break


end
end
term.setCursorPos(arg1,arg2)
end

term.setCursorPos(arg1,arg2)
local options={
"Open/Close Doors",
"Exit"
}
end

local h = CUI(options)


end ---[[ FAIL ABOVE THIS MARKER! ]]--- ---[[ FAIL ABOVE THIS MARKER! ]]--- ---[[ FAIL ABOVE THIS MARKER! ]]--- ---[[ FAIL ABOVE THIS MARKER! ]]---





function menu3(id, text)
if Line3 == id then
write"-> "
elseif Line3 == 1 then
write" "
if Line3 == 2 then
write" "
elseif Line3 == 3 then
write" "
if Line3 == 4 then
write" "
elseif Line3 == 5 then
write" "
if Line3 == 6 then
write" "
elseif Line3 == 7 then
write" "
if Line3 == 8 then
write" "







end
end
end
end
end
print(text)
end

function menu3edit(arg1, arg2, arg3, arg4)

function CUI(m)
n=1
l=#m
while true do
term.clear()
term.setCursorPos(arg1,arg2)

for i=1, l, 1 do
if i==n then print(i, " ["..m[i].."]") else print(i, " ", m[i]) end

end

print("Select a number[arrow up/arrow down]")
a, b= os.pullEventRaw()
if a == "key" then
if b==200 and n>1 then
n=n-1
end
if b==208 and n<l then
n=n+1
end
if b==28 then

if n==1 then
loopJail = true
Jail()
Jails()
break
end
if n==2 then
if D1 == "-" then
D1 = "!"
elseif D1 == "!" then
D1 = "-"
end
break
end
if n==3 then

if D2 == "-" then
D2 = "!"
elseif D2 == "!" then
D2 = "-"
end
break
end
if n==4 then
if D3 == "-" then
D3 = "!"
elseif D3 == "!" then
D3 = "-"
end
break
end
if n==5 then
if D4 == "-" then
D4 = "!"
elseif D4 == "!" then
D4 = "-"
end
break
end
if n==6 then
if D5 == "-" then
D5 = "!"
elseif D5 == "!" then
D5 = "-"
end
break
end
if n==7 then
if D6 == "-" then
D6 = "!"
elseif D6 == "!" then
D6 = "-"
end
break
end
if n==8 then
if D7 == "-" then
D7 = "!"
elseif D7 == "!" then
D7 = "-"
end
break
end
if n==9 then
if D8 == "-" then
D8 = "!"
elseif D8 == "!" then
D8 = "-"
end
break
end
if n==10 then
if D9 == "-" then
D9 = "!"
elseif D9 == "!" then
D9 = "-"
end
break
end
if n==11 then
if DX1 == "!" then
DX1 = "-"
elseif DX1 == "-" then
DX1 = "!"
end
break
end
if n==12 then
if DX2 == "!" then
DX2 = "-"
elseif DX2 == "-" then
DX2 = "!"
end
break
end


end
end
end
end
term.setCursorPos(arg1,arg2)
local options={
"Back",
"Door1",
"Door2",
"Door3",
"Door4",
"Door5",
"Door6",
"Door7",
"Door8",
"Door9",
"MainDoor1",
"MainDoor2"
}



local n=CUI(options)

end

---]] SECTION: MENU

---[[ SECTION: JAIL SCREEN

function Jails1()

while loopJail1 do
menu2edit(10,8)




while loopSelector do


while loop3 do



--[[menus]]--

menu3edit(1, 4, 1, 4)

--[[MENUS]]--



event, key = os.pullEvent("key")
if key == 200 then
if Line3 > 0 then
Line3 = Line3 - 1
end
elseif key == 208 then
if Line3 < 1 then
Line3 = Line3 + 1
end
elseif key == 28 then
if Line3 == 0 then
loop3 = false

end

elseif Line3 == 1 then
loop3 = false

elseif Line3 == 2 then
loop3 = false

elseif Line3 == 3 then
loop3 = false

elseif Line3 == 4 then
loop3 = false

elseif Line3 == 5 then
loop3 = false

elseif Line3 == 6 then
loop3 = false

elseif Line3 == 7 then
loop3 = false

elseif Line3 == 8 then
loop3 = false

elseif Line3 == 9 then
loop3 = false



break
end


loop3 = true

end
end
loopSelector = false
end
end

function Jail()
term.clear()
term.setCursorPos(1,1)
loopJail1 = true
print("+--------------------------+")
print("+ Loading Jail OverView... +")
print("+--------------------------+")
sleep(0.4)
while loopJail do
loopJail = false
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("+---+---+---+---+---+---+---+---+---+")
textutils.slowPrint("+ 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +")
textutils.slowPrint("+-"..D1.."-+-"..D2.."-+-"..D3.."-+-"..D4.."-+-"..D5.."-+-"..D6.."-+-"..D7.."-+-"..D8.."-+-"..D9.."-+")
term.setCursorPos(1,4)
print("+---+")
print(""..DX1.."   "..DX2.."")
print("+---+")
sleep(0.7)
term.setCursorPos(1,10)
print("Below, the WARNING Messages will show!")
sleep(4)
term.setCursorPos(1,10)
term.clearLine()
if D1 == "!" then
term.setCursorPos(3,10)
WarMsG = "+ Door1 is Open! +"
print(WarMsG)
end
if D2 == "!" then
term.setCursorPos(3,11)
WarMsG = "+ Door2 is Open! +"
print(WarMsG)
end
if D3 == "!" then
term.setCursorPos(3,12)
WarMsG = "+ Door3 is Open! +"
print(WarMsG)
end
if D4 == "!" then
term.setCursorPos(3,13)
WarMsG = "+ Door4 is Open! +"
print(WarMsG)
end
if D5 == "!" then
term.setCursorPos(3,14)
WarMsG = "+ Door5 is Open! +"
print(WarMsG)
end
if D6 == "!" then
term.setCursorPos(3,15)
WarMsG = "+ Door6 is Open! +"
print(WarMsG)
end
if D7 == "!" then
term.setCursorPos(16,10)
WarMsG = "+ Door7 is Open! +"
print(WarMsG)
end
if D8 == "!" then
term.setCursorPos(16,11)
WarMsG = "+ Door8 is Open! +"
print(WarMsG)
end
if D9 == "!" then
term.setCursorPos(16,12)
WarMsG = "+ Door9 is Open! +"
print(WarMsG)
end
if DX1 == "-" then
term.setCursorPos(16,13)
WarMsG = "+ MainDoor1 = Open +"
print(WarMsG)
OptionsMenu30 = "true"
end
if DX2 == "-" then
term.setCursorPos(16,14)
WarMsG = "+ MainDoor2 = Open +"
print(WarMsG)
OptionsMenu30 = "true"
end







end

Jails1()
end

---]] SECTION: JAIL SCREEN
---[[ SECTION: BOOT

function Boot1() ---[[ MY BOOT SYSTEM is about 200 lines long! i've used alot of time on it, but this System is only for myself! ]]---

term.clear()
term.setCursorPos(1,1)
print("+----------------------------------------------+")
print("+#   #   #  ####  #	 ##   ##	## ##   ####+")
print("+ # # # #   ##	#	#	#  #  #  #  #  ##  +")
print("+  #   #	####  ###   ##   ##   #	 #  ####+")
print("+----------------------------------------------+")
sleep(1.7)
term.clear()
term.setCursorPos(1,1)
print("+----------------------------------------------+")
print("+											  +")
print("+											  +")
print("+											  +")
print("+----------------------------------------------+")
sleep(0.3)
term.setCursorPos(1,2)
term.clearLine()
print("+##  ##										+")
term.setCursorPos(1,3)
term.clearLine()
print("+  ##										  +")
term.setCursorPos(1,4)
term.clearLine()
print("+##  ##										+")
sleep(0.3)
term.setCursorPos(1,2)
term.clearLine()
print("+######										+")
term.setCursorPos(1,3)
term.clearLine()
print("+######										+")
term.setCursorPos(1,4)
term.clearLine()
print("+######										+")
sleep(0.78)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ##  ##								 +")
term.setCursorPos(1,3)
term.clearLine()
print("+######   ##								   +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ##  ##								 +")
sleep(0.4)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ######								 +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ######								 +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ######								 +")
sleep(0.02)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ##  ##						  +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ######   ##							+")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ##  ##						  +")
sleep(0.7)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ######						  +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ######						  +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ######						  +")
sleep(0.3)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ##  ##				   +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ######   ##					 +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ##  ##				   +")
sleep(0.3)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ######				   +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ######				   +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ######				   +")
sleep(0.4)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ###### ##  ##			+")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ######   ##			  +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ###### ##  ##			+")
sleep(0.8)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ###### ######			+")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ###### ######			+")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ###### ######			+")
sleep(0.45)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ###### ###### ###   ###  +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ###### ######	###	 +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ###### ###### ###   ###  +")
sleep(0.91)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ###### ###### #########  +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ###### ###### #########  +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ###### ###### #########  +")
sleep(0.4)
term.clear()
term.setCursorPos(1,1)
print("+----------------------------------------------+")
textutils.slowPrint("+ #	 ##	 #	###   ####  ###   ######   +")
textutils.slowPrint("+ #	#  #   ###   #  #  ##	#  #   ####	+")
textutils.slowPrint("+ ###   ##   #   #  ###   ####  ###	 ##	 +")
print("+----------------------------------------------+")
sleep(0.3)
print("+----------------------------------------------+")
print("+									   ##	 +")
print("+									  ####	+")
print("+									   ##	 +")
print("+----------------------------------------------+")
sleep(2.3)

term.setCursorPos(5,8)
textutils.slowPrint("Made by: #NOT VALID ONLINE#")
sleep(5)

end

function StartText(arg1,arg2)
term.setCursorPos(arg1,arg2)
print("+--------------------------------------+")
term.setCursorPos(arg1,arg2+1)
print("+									  +")
term.setCursorPos(arg1,arg2+2)
print("+--------------------------------------+")
sleep(0.14)
term.setCursorPos(arg1+3,arg2+1)
textutils.slowPrint("Made by: #NOT VAILID ONLINE# ")
sleep(0.9)
term.clearLine()
term.setCursorPos(arg1,arg2+1)
print("+									  +")
term.setCursorPos(arg1,arg2+2)
print("+--------------------------------------+")
term.setCursorPos(arg1+3,arg2+1)
textutils.slowPrint("Animations by:")
sleep(1.7)
term.setCursorPos(arg1+3,arg2+1)
textutils.slowPrint("#NOT VALID ONLINE#")
end

function StartText1(arg1,arg2)
term.setCursorPos(arg1,arg2)
print("+------------------------------------------+")
term.setCursorPos(arg1,arg2+1)
print("+										  +")
term.setCursorPos(arg1,arg2+2)
print("+------------------------------------------+")
sleep(0.3)
term.setCursorPos(arg1+3,arg2+1)
textutils.slowPrint("Use Arrow Keys to move Up/Down! ")
sleep(0.8)
term.setCursorPos(arg1,arg2+4)
print("+------------------------------------------+")
term.setCursorPos(arg1,arg2+5)
print("+										  +")
term.setCursorPos(arg1,arg2+6)
print("+------------------------------------------+")
sleep(0.3)
term.setCursorPos(arg1+3,arg2+5)
textutils.slowPrint("Use 'enter' to start the option!")

end

function JailText()
term.clear()
term.setCursorPos(1,6)
term.clearLine()
print("+---------------------------------------------+")
term.setCursorPos(1,7)
term.clearLine()
print("+  #####	   #	  #  #					+")
term.setCursorPos(1,8)
term.clearLine()
print("+	   #	 # #	 #  #					+")
term.setCursorPos(1,9)
term.clearLine()
print("+	   #	#####	#  #					+")
term.setCursorPos(1,10)
term.clearLine()
print("+  #	#   #	 #   #  #					+")
term.setCursorPos(1,11)
term.clearLine()	
print("+   ####   #	   #  #  ######			   +")
term.setCursorPos(1,12)
term.clearLine()
print("+---------------------------------------------+")
sleep(0.37)
while BootLoop1 do
term.setCursorPos(30,9)
textutils.slowPrint("Systematics")
BootLoop1 = false
BootLoop0 = true
end

while BootLoop0 do
term.setCursorPos(30,9)
print("Systematics")


BootLoop0 = false
end
BootLoop0 = true
end

Boot1()
---]] SECTION: BOOT
---[[ SECTION: LOGIN

function CheckAPILog()

JailText()
while loopLogin2 do
BootLoop0 = true

if loop4 == 1 then
loop4 = 0
JailText()
term.setCursorPos(1,1)
term.clearLine()
print("+------------------+")
term.setCursorPos(1,2)
term.clearLine()
print("+ Enter Password!  +")
term.setCursorPos(1,3)
term.clearLine()
print("+------------------+")
sleep(2)
term.setCursorPos(1,2)
print("+				  +")
term.setCursorPos(3,2)

PassWord = read("#")
if PassWord == "0903" then


term.setCursorPos(1,2)
print("+ Checking Input!  +")
sleep(2)
term.setCursorPos(1,2)
print("+ Password Correct +")
sleep(1.3)
loopLogin2 = false
   loopJail = true
Jail()
end
elseif PassWord ~= "0903" then
term.setCursorPos(1,2)
print("+ Checking Input!  +")
sleep(2)
term.setCursorPos(1,2)
print("+ Input Incorrect! +")
sleep(1.7)
loopLogin2 = true
loop4 = 1
end
end
end

if loop4 == 1 then
term.clear()
StartText(10,15)
StartText1(5,5)
while loop1 do
term.setCursorPos(1,1)
term.clearLine()
term.setCursorPos(1,2)
term.clearLine()

term.setCursorPos(2,1)
menu1(0, "Login")
term.setCursorPos(2,2)
menu1(1, "Exit")
event, key = os.pullEvent("key")
if key == 200 then
if Line1 > 0 then
Line1 = Line1 - 1
end
elseif key == 208 then
if Line1 < 1 then
Line1 = Line1 + 1
end
elseif key == 28 then
if Line1 == 0 then --Login System Automation
JailText()
loop1 = false
loopLogin1 = true
while loopLogin1 do
term.setCursorPos(1,1)
term.clearLine()
print("+------------------+")
term.setCursorPos(1,2)
term.clearLine()
print("+ Enter Username:  +")
term.setCursorPos(1,3)
term.clearLine()
print("+------------------+")
sleep(2)
term.setCursorPos(1,2)
term.clearLine()
term.setCursorPos(1,2)
print("+				  +")
term.setCursorPos(3,2)
UserName = read()
if UserName == "Admin1" then
sleep(0.6)
term.setCursorPos(1,2)
print("+ Checking input.  +")
sleep(2)
term.setCursorPos(1,2)
print("+ Username Found!  +")
sleep(1)
term.setCursorPos(1,2)
print("+ Welcome "..UserName.."   +")
sleep(2.3)
loopLogin1 = false
loopLogin2 = true
loop2 = true
while loopLogin2 do
while loop2 do
CheckAPILog()

end
loop2 = true
loopLogin2 = true

end
elseif UserName ~= "Admin1" then
sleep(0.6)
term.setCursorPos(1,2)
print("+ Checking input.  +")
sleep(1.7)
term.setCursorPos(1,2)
print("+ Input Not found! +")
sleep(1)

loopLogin1 = true
end

end

elseif Line1 == 1 then
os.shutdown()
end
loop1 = true

end
end
end
---]] SECTION: LOGIN


Thanks for reading that long code! but if you can solve my problem, then You will be my HERO!
SpoilerAre you tired of watching that long code?
but you are an hero if you can solve my problem :P/>/>
NO!
Cranium #2
Posted 24 September 2012 - 09:03 PM
You did not define the table "options" before it was called. I don't see that you defined it at all.

Edit: I see it now. You should put any program-wide variables at the top of your code. That way when calling back, it finds it. Lua reads top-down, left-right. Just put the options table at the top, or at least before you call to it.
As it is now, Lua is thinking that the table does not exist, and is trying to get the length(#) of nothing.
Goof #3
Posted 24 September 2012 - 09:05 PM
but i think i have that table "options". under the "menu2edit(arg1,arg2)" function (in the last part of the function) then "local h = CUI(options)

end


so my table should be started perfectly… or maybe not?



EDIT: now it works and is showing the "open/Close Doors" and the "Exit" but now, when i move the cursor, it says:
Goof #4
Posted 24 September 2012 - 09:33 PM
startup4:94: attempt to compare nil with number


my code is now:

Spoiler




---[[ SECTION: VARIABLES

D1 = "-"
D2 = "-"
D3 = "-"
D4 = "-"
D5 = "-"
D6 = "-"
D7 = "-"
D8 = "-"
D9 = "-"
DX1 = "!"
DX2 = "!"
loop1 = true
loop2 = false
loop3 = false
loop4 = 1
loop5 = 1
loop6 = 1
loopJail = false
loopJail1 = false
loopJail2 = false
loopLogin1 = false
loopLogin2 = false
loopSelector = false
loopSelector1 = false
loopSelector2 = false
loopSelector3 = false
OptionC = 0
OptionB = 0
Line1 = 0
Line2 = 0
Line3 = 0
Line4 = 0
BootLoop0 = false
BootLoop1 = true

---]] SECTION: VARIABLES

---[[ SECTION: MENU

function menu1(id, text)
if Line1 == id then
write"-> "
elseif Line1 == 1 then
write" "
end
print(text)
end

function menu2(id, text)
if Line2 == id then
write"-> "
elseif Line2 == 1 then
write" "
elseif Line2 == 2 then
write" "
end
print(text)
end





function menu2edit(arg1, arg2)  --- Function menu2 edit....       



local options={
"Open/Close Doors",
"Exit"
}

loopCuI = true
function CUI(m)
h=1
j=#m 
while loopCuI do
term.clear()
term.setCursorPos(arg1,arg2)

for i=1, j, 1 do
if i==h then print(i, " ["..m[i].."]") else print(i, " ", m[i]) end
end


a, b= os.pullEventRaw()
if a == "key" then
if b==200 and h>1 then 
h=h-1 
end
if b==208 and h<l then 
h=h+1 
end
if b==28 then 


if h==1 then
loop3 = true
loopCuI = false



while loop3 do



--[[menus]]--

menu3edit(1, 4, 1, 4)

--[[MENUS]]--



event, key = os.pullEvent("key")
if key == 200 then
if Line3 > 0 then
Line3 = Line3 - 1
end
elseif key == 208 then
if Line3 < 1 then
Line3 = Line3 + 1
end
elseif key == 28 then
if Line3 == 0 then 
loop3 = false

end

elseif Line3 == 1 then
loop3 = false

elseif Line3 == 2 then
loop3 = false

elseif Line3 == 3 then
loop3 = false

elseif Line3 == 4 then
loop3 = false

elseif Line3 == 5 then
loop3 = false

elseif Line3 == 6 then
loop3 = false

elseif Line3 == 7 then
loop3 = false

elseif Line3 == 8 then
loop3 = false

elseif Line3 == 9 then
loop3 = false



break
end


loop3 = true

end
end
elseif h==2 then
os.shutdown()
break


end
end
term.setCursorPos(arg1,arg2)
end

term.setCursorPos(arg1,arg2)


end
local h = CUI(options)



end                                                 ---[[ Function menu2edit(arg1,arg2) ]]---





function menu3(id, text)
if Line3 == id then
write"-> "
elseif Line3 == 1 then
write" "
if Line3 == 2 then
write" "
elseif Line3 == 3 then
write" "
if Line3 == 4 then
write" "
elseif Line3 == 5 then
write" "
if Line3 == 6 then
write" "
elseif Line3 == 7 then
write" "
if Line3 == 8 then
write" "







end
end
end
end
end
print(text)
end

function menu3edit(arg1, arg2, arg3, arg4)

function CUI(m)
n=1
l=#m
while true do
term.clear()
term.setCursorPos(arg1,arg2)

for i=1, l, 1 do
if i==n then print(i, " ["..m[i].."]") else print(i, " ", m[i]) end

end

print("Select a number[arrow up/arrow down]")
a, b= os.pullEventRaw()
if a == "key" then
if b==200 and n>1 then 
n=n-1 
end
if b==208 and n<l then 
n=n+1 
end
if b==28 then 

if n==1 then
loopJail = true
Jail()
Jails()
break
end
if n==2 then 
if D1 == "-" then
D1 = "!"
elseif D1 == "!" then
D1 = "-"
end
break
end
if n==3 then

if D2 == "-" then
D2 = "!"
elseif D2 == "!" then
D2 = "-"
end
break
end
if n==4 then
if D3 == "-" then
D3 = "!"
elseif D3 == "!" then
D3 = "-"
end
break 
end
if n==5 then
if D4 == "-" then
D4 = "!"
elseif D4 == "!" then
D4 = "-"
end
break 
end
if n==6 then
if D5 == "-" then
D5 = "!"
elseif D5 == "!" then
D5 = "-"
end
break 
end
if n==7 then
if D6 == "-" then
D6 = "!"
elseif D6 == "!" then
D6 = "-"
end
break 
end
if n==8 then
if D7 == "-" then
D7 = "!"
elseif D7 == "!" then
D7 = "-"
end
break 
end
if n==9 then
if D8 == "-" then
D8 = "!"
elseif D8 == "!" then
D8 = "-"
end
break 
end
if n==10 then
if D9 == "-" then
D9 = "!"
elseif D9 == "!" then
D9 = "-"
end
break 
end
if n==11 then
if DX1 == "!" then
DX1 = "-"
elseif DX1 == "-" then
DX1 = "!"
end
break
end
if n==12 then
if DX2 == "!" then
DX2 = "-"
elseif DX2 == "-" then
DX2 = "!"
end
break
end


end
end
end
end
term.setCursorPos(arg1,arg2)
local options={
"Back",
"Door1",
"Door2",
"Door3",
"Door4",
"Door5",
"Door6",
"Door7",
"Door8",
"Door9",
"MainDoor1",
"MainDoor2"
}



local n=CUI(options)

end

---]] SECTION: MENU

---[[ SECTION: JAIL SCREEN

function Jails1()

while loopJail1 do
menu2edit(10,8)




while loopSelector do


while loop3 do



--[[menus]]--

menu3edit(1, 4, 1, 4)

--[[MENUS]]--



event, key = os.pullEvent("key")
if key == 200 then
if Line3 > 0 then
Line3 = Line3 - 1
end
elseif key == 208 then
if Line3 < 1 then
Line3 = Line3 + 1
end
elseif key == 28 then
if Line3 == 0 then 
loop3 = false

end

elseif Line3 == 1 then
loop3 = false

elseif Line3 == 2 then
loop3 = false

elseif Line3 == 3 then
loop3 = false

elseif Line3 == 4 then
loop3 = false

elseif Line3 == 5 then
loop3 = false

elseif Line3 == 6 then
loop3 = false

elseif Line3 == 7 then
loop3 = false

elseif Line3 == 8 then
loop3 = false

elseif Line3 == 9 then
loop3 = false



break
end


loop3 = true

end
end
loopSelector = false
end
end

function Jail()
term.clear()
term.setCursorPos(1,1)
loopJail1 = true
print("+--------------------------+")
print("+ Loading Jail OverView... +")
print("+--------------------------+")
sleep(0.4)
while loopJail do
loopJail = false
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("+---+---+---+---+---+---+---+---+---+")
textutils.slowPrint("+ 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 +")
textutils.slowPrint("+-"..D1.."-+-"..D2.."-+-"..D3.."-+-"..D4.."-+-"..D5.."-+-"..D6.."-+-"..D7.."-+-"..D8.."-+-"..D9.."-+")
term.setCursorPos(1,4)
print("+---+")
print(""..DX1.."   "..DX2.."")
print("+---+")
sleep(0.7)
term.setCursorPos(1,10)
print("Below, the WARNING Messages will show!")
sleep(4)
term.setCursorPos(1,10)
term.clearLine()
if D1 == "!" then
term.setCursorPos(3,10)
WarMsG = "+ Door1 is Open! +"
print(WarMsG)
end
if D2 == "!" then
term.setCursorPos(3,11)
WarMsG = "+ Door2 is Open! +"
print(WarMsG)
end
if D3 == "!" then
term.setCursorPos(3,12)
WarMsG = "+ Door3 is Open! +"
print(WarMsG)
end
if D4 == "!" then
term.setCursorPos(3,13)
WarMsG = "+ Door4 is Open! +"
print(WarMsG)
end
if D5 == "!" then
term.setCursorPos(3,14)
WarMsG = "+ Door5 is Open! +"
print(WarMsG)
end
if D6 == "!" then
term.setCursorPos(3,15)
WarMsG = "+ Door6 is Open! +"
print(WarMsG)
end
if D7 == "!" then
term.setCursorPos(16,10)
WarMsG = "+ Door7 is Open! +"
print(WarMsG)
end
if D8 == "!" then
term.setCursorPos(16,11)
WarMsG = "+ Door8 is Open! +"
print(WarMsG)
end
if D9 == "!" then
term.setCursorPos(16,12)
WarMsG = "+ Door9 is Open! +"
print(WarMsG)
end
if DX1 == "-" then
term.setCursorPos(16,13)
WarMsG = "+ MainDoor1 = Open +"
print(WarMsG)
OptionsMenu30 = "true"
end
if DX2 == "-" then
term.setCursorPos(16,14)
WarMsG = "+ MainDoor2 = Open +"
print(WarMsG)
OptionsMenu30 = "true"
end







end

Jails1()
end

---]] SECTION: JAIL SCREEN
---[[ SECTION: BOOT

function Boot1() ---[[ I WILL NOT SHOW MY BOOT SYSTEM, BECAUSE IT WOULD GIVE 200 EXTRA LINES OF CODE.....]]---

term.clear()
term.setCursorPos(1,1)
print("+----------------------------------------------+")
print("+#   #   #  ####  #     ##   ##    ## ##   ####+")
print("+ # # # #   ##    #    #    #  #  #  #  #  ##  +")
print("+  #   #    ####  ###   ##   ##   #     #  ####+")
print("+----------------------------------------------+")
sleep(1.7)
term.clear()
term.setCursorPos(1,1)
print("+----------------------------------------------+")
print("+                                              +")
print("+                                              +")
print("+                                              +")
print("+----------------------------------------------+")
sleep(0.3)
term.setCursorPos(1,2)
term.clearLine()
print("+##  ##                                        +")
term.setCursorPos(1,3)
term.clearLine()
print("+  ##                                          +")
term.setCursorPos(1,4)
term.clearLine()
print("+##  ##                                        +")
sleep(0.3)
term.setCursorPos(1,2)
term.clearLine()
print("+######                                        +")
term.setCursorPos(1,3)
term.clearLine()
print("+######                                        +")
term.setCursorPos(1,4)
term.clearLine()
print("+######                                        +")
sleep(0.78)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ##  ##                                 +")
term.setCursorPos(1,3)
term.clearLine()
print("+######   ##                                   +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ##  ##                                 +")
sleep(0.4)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ######                                 +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ######                                 +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ######                                 +")
sleep(0.02)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ##  ##                          +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ######   ##                            +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ##  ##                          +")
sleep(0.7)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ######                          +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ######                          +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ######                          +")
sleep(0.3)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ##  ##                   +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ######   ##                     +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ##  ##                   +")
sleep(0.3)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ######                   +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ######                   +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ######                   +")
sleep(0.4)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ###### ##  ##            +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ######   ##              +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ###### ##  ##            +")
sleep(0.8)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ###### ######            +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ###### ######            +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ###### ######            +")
sleep(0.45)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ###### ###### ###   ###  +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ###### ######    ###     +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ###### ###### ###   ###  +")
sleep(0.91)
term.setCursorPos(1,2)
term.clearLine()
print("+###### ###### ###### ###### ###### #########  +")
term.setCursorPos(1,3)
term.clearLine()
print("+###### ###### ###### ###### ###### #########  +")
term.setCursorPos(1,4)
term.clearLine()
print("+###### ###### ###### ###### ###### #########  +")
sleep(0.4)
term.clear()
term.setCursorPos(1,1)
print("+----------------------------------------------+")
textutils.slowPrint("+ #     ##     #    ###   ####  ###   ######   +")
textutils.slowPrint("+ #    #  #   ###   #  #  ##    #  #   ####    +")
textutils.slowPrint("+ ###   ##   #   #  ###   ####  ###     ##     +")
print("+----------------------------------------------+")
sleep(0.3)
print("+----------------------------------------------+")
print("+                                       ##     +")
print("+                                      ####    +")
print("+                                       ##     +")
print("+----------------------------------------------+")
sleep(2.3)

term.setCursorPos(5,8)
textutils.slowPrint("Made by: #NOT VALID ONLINE#")
sleep(5)

end

function StartText(arg1,arg2)
term.setCursorPos(arg1,arg2)
print("+--------------------------------------+")
term.setCursorPos(arg1,arg2+1)
print("+                                      +")
term.setCursorPos(arg1,arg2+2)
print("+--------------------------------------+")
sleep(0.14)
term.setCursorPos(arg1+3,arg2+1)
textutils.slowPrint("Made by: #NOT VAILID ONLINE# ")
sleep(0.9)
term.clearLine()
term.setCursorPos(arg1,arg2+1)
print("+                                      +")
term.setCursorPos(arg1,arg2+2)
print("+--------------------------------------+")
term.setCursorPos(arg1+3,arg2+1)
textutils.slowPrint("Animations by:")
sleep(1.7)
term.setCursorPos(arg1+3,arg2+1)
textutils.slowPrint("#NOT VALID ONLINE#")
end

function StartText1(arg1,arg2)
term.setCursorPos(arg1,arg2)
print("+------------------------------------------+")
term.setCursorPos(arg1,arg2+1)
print("+                                          +")
term.setCursorPos(arg1,arg2+2)
print("+------------------------------------------+")
sleep(0.3)
term.setCursorPos(arg1+3,arg2+1)
textutils.slowPrint("Use Arrow Keys to move Up/Down! ")
sleep(0.8)
term.setCursorPos(arg1,arg2+4)
print("+------------------------------------------+")
term.setCursorPos(arg1,arg2+5)
print("+                                          +")
term.setCursorPos(arg1,arg2+6)
print("+------------------------------------------+")
sleep(0.3)
term.setCursorPos(arg1+3,arg2+5)
textutils.slowPrint("Use 'enter' to start the option!")

end

function JailText()
term.clear()
term.setCursorPos(1,6)
term.clearLine()
print("+---------------------------------------------+")
term.setCursorPos(1,7)
term.clearLine()
print("+  #####       #      #  #                    +")
term.setCursorPos(1,8)
term.clearLine()
print("+       #     # #     #  #                    +")
term.setCursorPos(1,9)
term.clearLine()
print("+       #    #####    #  #                    +")
term.setCursorPos(1,10)
term.clearLine()
print("+  #    #   #     #   #  #                    +")
term.setCursorPos(1,11)
term.clearLine()     
print("+   ####   #       #  #  ######               +")
term.setCursorPos(1,12)
term.clearLine()
print("+---------------------------------------------+")
sleep(0.37)
while BootLoop1 do
term.setCursorPos(30,9)
textutils.slowPrint("Systematics")
BootLoop1 = false
BootLoop0 = true
end

while BootLoop0 do
term.setCursorPos(30,9)
print("Systematics")


BootLoop0 = false
end
BootLoop0 = true
end

Boot1()
---]] SECTION: BOOT
---[[ SECTION: LOGIN

function CheckAPILog()

JailText()
while loopLogin2 do
BootLoop0 = true

if loop4 == 1 then
loop4 = 0
JailText()
term.setCursorPos(1,1)
term.clearLine()
print("+------------------+")
term.setCursorPos(1,2)
term.clearLine()
print("+ Enter Password!  +")
term.setCursorPos(1,3)
term.clearLine()
print("+------------------+")
sleep(2)
term.setCursorPos(1,2)
print("+                  +")
term.setCursorPos(3,2)

PassWord = read("#")
if PassWord == "0903" then


term.setCursorPos(1,2)
print("+ Checking Input!  +")
sleep(2)
term.setCursorPos(1,2)
print("+ Password Correct +")
sleep(1.3)
loopLogin2 = false
   loopJail = true
Jail()
end
elseif PassWord ~= "0903" then
term.setCursorPos(1,2)
print("+ Checking Input!  +")
sleep(2)
term.setCursorPos(1,2)
print("+ Input Incorrect! +")
sleep(1.7)
loopLogin2 = true
loop4 = 1
end
end
end

if loop4 == 1 then
term.clear()
StartText(10,15)
StartText1(5,5)
while loop1 do
term.setCursorPos(1,1)
term.clearLine()
term.setCursorPos(1,2)
term.clearLine()

term.setCursorPos(2,1)
menu1(0, "Login")
term.setCursorPos(2,2)
menu1(1, "Exit")
event, key = os.pullEvent("key")
if key == 200 then
if Line1 > 0 then
Line1 = Line1 - 1
end
elseif key == 208 then
if Line1 < 1 then
Line1 = Line1 + 1
end
elseif key == 28 then
if Line1 == 0 then --Login System Automation
JailText()
loop1 = false
loopLogin1 = true
while loopLogin1 do
term.setCursorPos(1,1)
term.clearLine()
print("+------------------+")
term.setCursorPos(1,2)
term.clearLine()
print("+ Enter Username:  +")
term.setCursorPos(1,3)
term.clearLine()
print("+------------------+")
sleep(2)
term.setCursorPos(1,2)
term.clearLine()
term.setCursorPos(1,2)
print("+                  +")
term.setCursorPos(3,2)
UserName = read()
if UserName == "Admin1" then
sleep(0.6)
term.setCursorPos(1,2)
print("+ Checking input.  +")
sleep(2)
term.setCursorPos(1,2)
print("+ Username Found!  +")
sleep(1)
term.setCursorPos(1,2)
print("+ Welcome "..UserName.."   +")
sleep(2.3)
loopLogin1 = false
loopLogin2 = true
loop2 = true
while loopLogin2 do
while loop2 do
CheckAPILog()

end
loop2 = true
loopLogin2 = true

end
elseif UserName ~= "Admin1" then
sleep(0.6)
term.setCursorPos(1,2)
print("+ Checking input.  +")
sleep(1.7)
term.setCursorPos(1,2)
print("+ Input Not found! +")
sleep(1)

loopLogin1 = true
end

end

elseif Line1 == 1 then
os.shutdown()
end
loop1 = true

end
end
end
---]] SECTION: LOGIN






damn i'm so bad to lua :P/>/>