Posted 10 July 2012 - 11:19 PM
Hello,
I got a new project to script a menu on my computer
I have a image how it looks atm
Thats my startup but its wrong
the menu must be:
Maak een keuze:
[ Lampen 2Bizzzy ]
Lampen Arjen
Deur
Sorry its dutch:
translate:
lampen = lights
deur = door
when I go to a Light system then it looks like this
Translate:
Aan = Lights on
uit = Lights off
terug = back to main menu ( that meens os.reboot() )
but it has to looks like this
Lampen
[ Aan ]
Uit
Terug
this is the working script what i have right now but whit the wrong menu
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
else
term.write( "Keuze 3" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Maak een keuze" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Lampen 1 ]") or "Lampen 1" )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Deur 2 ]") or "Deur 2" )
printCentred( math.floor(h/2) + 2, ((nOption == 3) and "[ … 3 ]") or "… 3" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's Light System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Lampen" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Aan ]") or "Aan" )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Uit ]") or "Uit" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
end
elseif nOption == 2 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's Door System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Deur" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Openen ]") or "Openen " )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Sluiten ]") or "Sluiten" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "right"
local password = "sjoerd"
local opentime = "10"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
rs.setBundledOutput(side, colors.red)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "right"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
end
end
I edit it to what it must be but it failed i get the error :startup:line 242 <eof> expected
i had it on my working script to the fault was a forgoten end
Here is the script with the error
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
else
term.write( "Keuze 3" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Maak een keuze" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Lampen 2Bizzzy 1 ]") or "Lampen 2Bizzzy 1" )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Lampen Arjen 2 ]") or "Lampen Arjen 2" )
printCentred( math.floor(h/2) + 2, ((nOption == 3) and "[ Deur 3 ]") or "Deur 3" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
—– 2Bizzzy lampen —– 2Bizzzy lampen —– 2Bizzzy lampen
—– 2Bizzzy lampen —– 2Bizzzy lampen —– 2Bizzzy lampen
—– 2Bizzzy lampen —– 2Bizzzy lampen —– 2Bizzzy lampen
—– 2Bizzzy lampen —– 2Bizzzy lampen —– 2Bizzzy lampen
if nOption == 1 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's Light System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Lampen 2Bizzzy" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Aan ]") or "Aan" )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Uit ]") or "Uit" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
end
end
—– Arjen lampen—– Arjen lampen—– Arjen lampen
—– Arjen lampen—– Arjen lampen—– Arjen lampen
—– Arjen lampen—– Arjen lampen—– Arjen lampen
—– Arjen lampen—– Arjen lampen—– Arjen lampen
elseif nOption == 2 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "Arjen's Light System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
elseif nOption == 3 then
term.write( "Keuze 3" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Lampen Arjen" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Aan ]") or "Aan " )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Uit ]") or "Uit " )
printCentred( math.floor(h/2) + 2, ((nOption == 3) and "[ Terug ]") or "Terug" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 3 then
os.reboot()
end
end
—– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur
—– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur
—– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur
—– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur
elseif nOption == 3 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's Door System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Deur" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Openen ]") or "Openen " )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Sluiten ]") or "Sluiten" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "right"
local password = "sjoerd"
local opentime = "10"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
rs.setBundledOutput(side, colors.red)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "right"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
end
end
Maybe if your dutch and you dont understand my topic :)/>/> you can add me on skype : keltjens1995 and vist me on my own Tekkit 3.0.3 server!
I hope you can help me
I got a new project to script a menu on my computer
I have a image how it looks atm
Thats my startup but its wrong
the menu must be:
Maak een keuze:
[ Lampen 2Bizzzy ]
Lampen Arjen
Deur
Sorry its dutch:
translate:
lampen = lights
deur = door
when I go to a Light system then it looks like this
Translate:
Aan = Lights on
uit = Lights off
terug = back to main menu ( that meens os.reboot() )
but it has to looks like this
Lampen
[ Aan ]
Uit
Terug
this is the working script what i have right now but whit the wrong menu
Spoiler
local w,h = term.getSize()function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
else
term.write( "Keuze 3" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Maak een keuze" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Lampen 1 ]") or "Lampen 1" )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Deur 2 ]") or "Deur 2" )
printCentred( math.floor(h/2) + 2, ((nOption == 3) and "[ … 3 ]") or "… 3" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's Light System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Lampen" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Aan ]") or "Aan" )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Uit ]") or "Uit" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
end
elseif nOption == 2 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's Door System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Deur" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Openen ]") or "Openen " )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Sluiten ]") or "Sluiten" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "right"
local password = "sjoerd"
local opentime = "10"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
rs.setBundledOutput(side, colors.red)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "right"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
end
end
I edit it to what it must be but it failed i get the error :startup:line 242 <eof> expected
i had it on my working script to the fault was a forgoten end
Here is the script with the error
Spoiler
local w,h = term.getSize()function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
else
term.write( "Keuze 3" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Maak een keuze" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Lampen 2Bizzzy 1 ]") or "Lampen 2Bizzzy 1" )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Lampen Arjen 2 ]") or "Lampen Arjen 2" )
printCentred( math.floor(h/2) + 2, ((nOption == 3) and "[ Deur 3 ]") or "Deur 3" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
—– 2Bizzzy lampen —– 2Bizzzy lampen —– 2Bizzzy lampen
—– 2Bizzzy lampen —– 2Bizzzy lampen —– 2Bizzzy lampen
—– 2Bizzzy lampen —– 2Bizzzy lampen —– 2Bizzzy lampen
—– 2Bizzzy lampen —– 2Bizzzy lampen —– 2Bizzzy lampen
if nOption == 1 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's Light System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Lampen 2Bizzzy" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Aan ]") or "Aan" )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Uit ]") or "Uit" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
end
end
—– Arjen lampen—– Arjen lampen—– Arjen lampen
—– Arjen lampen—– Arjen lampen—– Arjen lampen
—– Arjen lampen—– Arjen lampen—– Arjen lampen
—– Arjen lampen—– Arjen lampen—– Arjen lampen
elseif nOption == 2 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "Arjen's Light System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
elseif nOption == 3 then
term.write( "Keuze 3" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Lampen Arjen" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Aan ]") or "Aan " )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Uit ]") or "Uit " )
printCentred( math.floor(h/2) + 2, ((nOption == 3) and "[ Terug ]") or "Terug" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "left"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 3 then
os.reboot()
end
end
—– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur
—– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur
—– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur
—– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur —– 2Bizzzy Deur
elseif nOption == 3 then
local w,h = term.getSize()
function printCentred( y, s )
local x = math.floor((w - string.len(s)) / 2)
term.setCursorPos(x,y)
term.clearLine()
term.write( s )
end
local nOption = 1
– Display menu
local function drawMenu()
term.clear()
term.setCursorPos(1,1)
term.write( "2Bizzzy's Door System" )
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write( "Keuze 1" )
elseif nOption == 2 then
term.write( "Keuze 2" )
end
end
– Display the frontend
term.clear()
local function drawFrontend()
printCentred( math.floor(h/2) - 3, "" )
printCentred( math.floor(h/2) - 2, "Deur" )
printCentred( math.floor(h/2) - 1, "" )
printCentred( math.floor(h/2) + 0, ((nOption == 1) and "[ Openen ]") or "Openen " )
printCentred( math.floor(h/2) + 1, ((nOption == 2) and "[ Sluiten ]") or "Sluiten" )
printCentred( math.floor(h/2) + 3, "" )
end
– Call functions for display menu
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 or key == 200 then
– Up
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
– Down
if nOption < 3 then – Change 3 by the number of option.
nOption = nOption + 1
drawMenu()
drawFrontend()
end
elseif key == 28 then
– Enter
break
end
end
end
term.clear()
– Conditions
if nOption == 1 then
local side = "right"
local password = "sjoerd"
local opentime = "10"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.green)
sleep(opentime)
rs.setBundledOutput(side, colors.red)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
elseif nOption == 2 then
local side = "right"
local password = "sjoerd"
local opentime = "1"
term.clear()
term.setCursorPos(1,1)
write("Wachtwoord: ")
local input = read()
if input == password then
term.clear()
term.setCursorPos(1,1)
print("Wachtwoord Correct!")
rs.setBundledOutput(side, colors.red)
sleep(opentime)
os.reboot()
else
term.clear()
term.setCursorPos(1,1)
Print("Wachtwoord Incorrect! Griefer?")
sleep(2)
os.reboot()
end
end
end
Maybe if your dutch and you dont understand my topic :)/>/> you can add me on skype : keltjens1995 and vist me on my own Tekkit 3.0.3 server!
I hope you can help me