Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --made by Cryodine with hours of frustrating pain
- local event = require("event")
- local component = require("component")
- local gpu = component.gpu
- local redstone = component.redstone
- local x = 1
- local y = 1
- local num = -1
- local numstring = ""
- function setbutt(x1,y1,mx,my,lbl)
- gpu.setBackground(0x00ffff)
- gpu.setForeground(0x333333)
- xpos1 = ((w/mx)*(x1-1))+2
- ypos1 = ((h/my)*(y1-1))+2
- xpos2 = (w/mx)-1
- ypos2 = (h/my)-1
- midx = (xpos1 + (xpos2/2))-1
- midy = (ypos1 + (ypos2/2))-1
- gpu.fill(xpos1,ypos1,xpos2,ypos2," ")
- gpu.set(midx,midy,lbl)
- gpu.setBackground(0x333333)
- gpu.setForeground(0x00ffff)
- return {xpos1,ypos1,xpos1+xpos2,ypos1+ypos2}
- end
- function chkpress(a,tx,ty)
- if tx >= a[1] and tx <= a[3] and ty >= a[2] and ty <= a[4] then
- return true
- else
- return false
- end
- end
- while true do
- mw,mh = gpu.maxResolution()
- square = math.min(mw,mh)
- gpu.setResolution(square/2,square/4)
- w,h = gpu.getResolution()
- gpu.setForeground(0x00ffff)
- gpu.setBackground(0x333333)
- gpu.fill(1,1,w,h," ")
- gpu.set(1,1,numstring)
- --gpu.set(1,1,x..y)
- --gpu.set(1,2,tostring(num))
- -- gpu.set(1,4,numstring)
- lbl = 1
- coords = {}
- for i = 1, 3, 1 do
- for k = 1, 3, 1 do
- table.insert(coords,lbl,setbutt(k,i,3,4,tostring(lbl)))
- lbl = lbl + 1
- end
- end
- table.insert(coords,10,setbutt(2,4,3,4,"0"))
- table.insert(coords,11,setbutt(3,4,3,4,">"))
- table.insert(coords,12,setbutt(1,4,3,4,"c"))
- _,p,x,y = event.pull("touch")
- for i = 1, 9, 1 do
- if chkpress(coords[i],x,y) then
- num = i
- break
- elseif chkpress(coords[10],x,y) then
- num = 0
- break
- else
- num = -1
- end
- end
- if chkpress(coords[12],x,y) then
- numstring = ""
- end
- if num ~= -1 then
- numstring = numstring .. tostring(num)
- end
- if chkpress(coords[11],x,y) then
- if numstring == "6969" then --change passcode here
- redstone.setOutput(1,16)
- os.sleep(3)
- redstone.setOutput(1,0)
- numstring = ""
- else
- numstring = ""
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement