Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = shell
- t = term
- c = colors
- m = math
- local function mittig(vtext, y)
- w, h = t.getSize()
- mitte = m.floor((w/2) - (string.len(vtext)/2))
- t.setCursorPos(mitte, y)
- t.write(vtext)
- end
- local function pruefeXY( x, y )
- if x < 0 then x = 0 end
- if x > 2 then x = 2 end
- if y < 0 then y = 0 end
- if y > 2 then y = 2 end
- return x, y
- end
- local function zeigeCode( vcode )
- mittig("| [ ] [ ] [ ] [ ] |", 9)
- for codeLaenge = 1, string.len(vcode), 1 do
- t.setTextColor(c.lightBlue)
- t.setCursorPos((w/2)-(13/2)+((codeLaenge-1)*4), 9)
- t.write(string.sub(vcode, codeLaenge, codeLaenge))
- end
- t.setTextColor(c.lightGray)
- end
- local function pinPad()
- x = 0
- y = 0
- w, h = t.getSize()
- code = ""
- t.setTextColor(c.lightGray)
- mittig("[ PASSWORT! ]", 3)
- mittig("| --------------- |", 4)
- mittig("| [1] [2] [3] |", 5)
- mittig("| [4] [5] [6] |", 6)
- mittig("| [7] [8] [9] |", 7)
- mittig("| --------------- |", 8)
- mittig("| [ ] [ ] [ ] [ ] |", 9)
- mittig("| --------------- |", 10)
- mittig("| [ ENTER ] |", 11)
- while true do
- ereignis, parameter = os.pullEvent("key")
- if ereignis == "key" then
- t.setCursorPos((w/2)-(15/2)+(x*6), 5 + y)
- t.write("[" .. math.floor((y*3) + (x+1)) .. "]")
- if parameter == 200 then -- Hoch
- y = y - 1
- end
- if parameter == 208 then -- Runter
- y = y + 1
- end
- if parameter == 203 then -- Links
- x = x - 1
- end
- if parameter == 205 then -- Rechts
- x = x + 1
- end
- x, y = pruefeXY(x,y) -- Rechnung für Zahl = (y*3) + (x+1)
- t.setCursorPos((w/2)-(15/2)+(x*6), 5 + y)
- t.setTextColor(c.magenta)
- t.write("[" .. math.floor((y*3) + (x+1)) .. "]")
- t.setTextColor(c.lightGray)
- if parameter == 57 then
- if string.len(code) < 4 then
- code = code .. (y*3) + (x+1)
- zeigeCode(code)
- end
- end
- if parameter == 14 then
- if string.len(code) >= 1 then
- code = string.sub(code, 1, string.len(code) - 1)
- zeigeCode(code)
- end
- end
- if parameter == 28 then
- if code == "4253" then
- t.clear()
- t.setTextColor(c.lime)
- mittig("ACCESS GRANTED", 3)
- t.setCursorPos(1, 5)
- break
- end
- end
- end
- end
- end
- local function ladeBalken(w)
- balkenFarbe = {16384,2,16,32,32}
- for prozent = 0, 100, 1 do
- t.setTextColor(m.floor(balkenFarbe[m.floor(prozent/25)+1]))
- t.setCursorPos((w/2)-12, 8)
- lbalken = "["
- for gleichzeichen = 0, prozent/5, 1 do
- lbalken = lbalken .. "="
- end
- lbalken = lbalken .. ">"
- for leerzeichen = 0, 22-string.len(lbalken), 1 do
- lbalken = lbalken .. " "
- end
- lbalken = lbalken .. "]"
- t.write(lbalken)
- t.setCursorPos((w/2)-2, 9)
- t.write(prozent.." %")
- sleep(0.02)
- end
- t.setTextColor(c.white)
- t.setCursorPos(1, 9)
- t.clearLine()
- t.setCursorPos(1, 8)
- t.clearLine()
- t.setCursorPos((w/2)-6, 8)
- t.write("WILLKOMMEN!")
- sleep(1.5)
- end
- local function startBildschirm()
- t.clear()
- w, h = t.getSize()
- t.setCursorPos((w/2)-8, 5)
- t.setTextColor(c.green)
- t.write("Starte EVA v0.7a")
- ladeBalken(w)
- end
- startBildschirm()
- pinPad()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement