Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print()
- local exitPressed = false
- local function DrawExit()
- term.setCursorPos(17,1)
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.black)
- print(" ")
- term.setBackgroundColor(colors.black)
- term.setTextColor(1)
- end
- local function findWhichButton(x,y)
- if (y == 5) and x == 2 then
- return 0
- elseif y==5 and (x==5 or x==6) then
- return -3
- elseif (y==3) and (10<x and x<16) then
- return 10
- elseif y==1 and x == 17 then
- return -1
- elseif x==2 or x==4 or x==6 then
- if y==2 then
- return x/2
- elseif y==3 then
- return x/2 + 3
- elseif y==4 then
- return x/2 + 6
- end
- end
- return -2
- end
- local function DrawBackSpace()
- end
- local function useKeyPad()
- local Num = 0
- print()
- for i = 1 ,9 do
- write("|")
- term.setTextColor(colors.lightBlue)
- write(i)
- term.setTextColor(1)
- if i%3==0 then write("|\n") end
- end
- write("|")
- term.setTextColor(colors.lightBlue)
- write(0)
- term.setTextColor(1)
- write("|[")
- term.setTextColor(colors.orange)
- write("<<")
- term.setTextColor(1)
- write("]")
- term.setCursorPos(10,3)
- write("[")
- term.setTextColor(colors.lime)
- write("Enter")
- term.setTextColor(1)
- write("]")
- DrawExit()
- local i = 0
- repeat
- local event, button, x, y = os.pullEvent("mouse_click")
- local Button = findWhichButton(x,y)
- if Button == 0 and i ~= 0 then
- Num = Num * 10
- i = i + 1
- elseif Button == 10 then
- i = 5
- elseif Button == -2 then
- elseif Button == -1 then
- i = 5
- exitPressed = true
- elseif Button == -3 then
- if i~=0 then
- Num = (Num - (Num%10))/10
- i = i - 1
- end
- else
- Num = Num*10 + Button
- i = i + 1
- end
- term.setCursorPos(1,1)
- term.clearLine(0)
- write(Num)
- DrawExit()
- until i > 3
- return Num
- end
- local a = useKeyPad()
- shell.execute("clear")
- print(a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement