startup4:93: attempt to compare nil with number
Can anyone help me out of this problem, and tell me what attempt to compare nil with number would mean?
my code is here: – BIG CODE – be careful –
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) [[scroll down to the marker]]
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 --[[IN THIS LINE IT SAYS THE ERROR startup4:93: attempt to compare nil with number ]]--
h=h+1 --[[I DONT UNDERSTAND WHAT THE ERROR MEANS, so can u guys please explain it, and/or solve my problem, plesae.]]--
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 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