The content of line 18 was term.clear()
I don't know what happened, if someone can help, thanks
os.pullEvent = os.pullEventRaw
local w,h = term.getSize()
function printCentered (y,s)
local x = math.floor((w - string.len(s)) /2)
term.setCursorPos(x,y)
term.clearLine()
term.write(s)
end
--Draw Menu Function
local nOption = 1
local function drawMenu
term.clear()
term.setCursorPos(1,1)
term.write("Rubik OS 0.1")
term.setCursorPos(w-11,1)
if nOption == 1 then
term.write("Comandos")
elseif nOption == 2 then
term.write("Programas")
elseif nOption == 3 then
term.write("Apagar")
elseif nOption == 4 then
term.write("Desinstalar")
else
end
end
--Gui
term.clear()
local function drawFrontend()
printCentered(math.floor(h/2) - 3, "")
printCentered(math.floor(h/2) - 2, "Menu Inicio")}
printCentered(math.floor(h/2) - 1, "")
printCentered(math.floor(h/2) + 0, ((nOption == 1 and "[ Comandos ]") or "Comandos" )
printCentered(math.floor(h/2) + 1, ((nOption == 2 and "[ Programas]") or "Programas")
printCentered(math.floor(h/2) + 2, ((nOption == 3 and "[ Apagar ]") or "Apagar"
printCentered(math.floor(h/2) + 3, ((nOption == 4 and "[ Desinstalar "] or "Desinstalar"
end
--Display
drawMenu()
drawFrontend()
while true do
local e,p = os.pullEvent()
if e == "key" then
local key = p
if key == 17 od key == 2000 then
if nOption > 1 then
nOption = nOption - 1
drawMenu()
drawFrontend()
end
elseif key == 31 or key == 208 then
if nOption < 4 then
nOption = nOption + 1
drawMenu()
drawFrontend()
end
end
elseif key == 28 then
break
end
end
end
term.clear()
--Conditions
if nOption == 1 then
shell.run("os/.command"
elseif nOption == 2 then
shell.run("os/.programs")
elseif nOption == 3 then
os.shutdown()
else
shell.run("os/.uninstall")
end
local function drawMenu
if key == 17 od key == 2000 then
Adding to that 2000 is too high to be a keycode. If you meant the up key it's 200(For better readability I suggest you use keys.up, keys.down, etc. Also if you are looking for keys that also queue a char event you should probably take the char event instead, because then you won't have problems with non-english keyboard layout(With a German keyboard layout it's always frustrating when people check for keys.y instead of the char "y" because I have to press z instead)In your while loop (bottom third of your script) you haveif key == 17 od key == 2000 then
I believe you wanted an 'or' instead of 'od'
elseif nOption == 4 then
term.write("Desinstalar")
else
end
printCentered(math.floor(h/2) - 2, "Menu Inicio")}
printCentered(math.floor(h/2) + 2, ((nOption == 3 and "[ Apagar ]") or "Apagar"
printCentered(math.floor(h/2) + 3, ((nOption == 4 and "[ Desinstalar "] or "Desinstalar"
Here in Line 45 you are also putting the ] outside of the string and you are missing the closing bracket after the string
printCentered(math.floor(h/2) + 0, ((nOption == 1 and "[ Comandos ]") or "Comandos" )
printCentered(math.floor(h/2) + 1, ((nOption == 2 and "[ Programas]") or "Programas")
shell.run("os/.command"
Thanks to all of you for helping me correcting this, it was written so badly but now doesn´t work because when i run it and says that "end" (line 85) is expected to close line 17 "fuction" any help?