What is it?
Spoiler
A program I've done while I was bored.It supports numbers from -9 to 9.
You have to "enter" the code with the mouse-wheel.
The code:
Spoiler
local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
local nubers = {}
local code {1,2,3}
local visible = {}
local checked = {}
local name = shell.getRunningProgram()
local x,y = term.getSize()
local valid = true
local ascii = [[
___________________
/ Secure Safe \
/ ____ \
| / \___ |
| | 00 |___| |
| \____/ |
\ /
\___________________/
]]
local currNum = 0
local currPos = 1
term.clear()
term.setCursorPos(1,1)
print(ascii)
while true do
local sEvent,a1,a2,a3 = os.pullEvent()
if sEvent == "mouse_scroll" then
if a1 == 1 then
if currNum > -9 then
currNum = currNum - 1
end
elseif a1 == -1 then
if currNum < 9 then
currNum = currNum + 1
end
end
elseif sEvent == "mouse_click" and a1 == 1 then
numbers[currPos] = currNum
visible[currPos] = (currNum .. " ")
currPos = currPos + 1
end
if numbers[#code] ~= nil then
break
end
term.clear()
term.setCursorPos(1,1)
print(ascii)
term.setCursorPos(24,9)
if currNum < 10 and currNum > -1 then
write("0"..currNum)
else
write(currNum)
end
term.setCursorPos((x/2)-(string.len(table.concat(visible))/2),15)
term.write(table.concat(visible))
end
for i = 1, #code do
if code[i] == numbers[i] then
checked[i] = true
else
checked[i] = false
end
end
for i = 1, #checked do
if checked[i] == false then
valid = false
break
end
end
if not valid then
term.clear()
term.setTextColor(colors.red)
term.setCursorPos((x/2)-string.len("WRONG.)/2,y/2)
term.write("WRONG.")
sleep(.25)
term.setTextColor(colors.white)
shell.run(name)
end
os.pullEvent = oldPull
term.clear()
term.setCursorPos(1,1)
Useless facts:
Spoiler
total lines:86Thx for reading
-Freack100-