Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CraftOS - CC Tweaked - Number Pad GUI using Basalt GUI
- -- Monitor Size: 7, 5
- basalt = require("basalt")
- code = "1771"
- input = ""
- last_finished = 0
- redstoneOn = false
- main = basalt.createFrame()
- textField = main:addTextfield()
- :setPosition(1,5)
- textField:addLine("In: ")
- local function update()
- -- Input won't show up, just *'s'
- textField:editLine(1, string.rep("*", #input) .. string.rep("-", 4 - #input))
- end
- local function check()
- if #input < 4 then
- return
- end
- if input == code then
- input = ""
- update()
- last_finished = os.clock()
- redstoneOn = true
- redstone.setOutput("back", redstoneOn)
- else
- input = ""
- update()
- end
- end
- local button1 = main
- :addButton()
- :setPosition(1,1)
- :setText("1")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "1"
- update()
- check()
- end)
- local button2 = main
- :addButton()
- :setPosition(2,1)
- :setText("2")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "2"
- update()
- check()
- end)
- local button3 = main
- :addButton()
- :setPosition(3,1)
- :setText("3")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "3"
- update()
- check()
- end)
- local button4 = main
- :addButton()
- :setPosition(1,2)
- :setText("4")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "4"
- update()
- check()
- end)
- local button5 = main
- :addButton()
- :setPosition(2,2)
- :setText("5")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "5"
- update()
- check()
- end)
- local button6 = main
- :addButton()
- :setPosition(3,2)
- :setText("6")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "6"
- update()
- check()
- end)
- local button7 = main
- :addButton()
- :setPosition(1,3)
- :setText("7")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "7"
- update()
- check()
- end)
- local button8 = main
- :addButton()
- :setPosition(2,3)
- :setText("8")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "8"
- update()
- check()
- end)
- local button9 = main
- :addButton()
- :setPosition(3,3)
- :setText("9")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "9"
- update()
- check()
- end)
- local button0 = main
- :addButton()
- :setPosition(2,4)
- :setText("0")
- :setSize(1,1)
- :onClick(
- function()
- input = input .. "0"
- update()
- check()
- end)
- while true do
- if os.clock() - last_finished > 5 then
- redstoneOn = false
- end
- redstone.setOutput("back", redstoneOn)
- sleep(0.15)
- end
- basalt:autoUpdate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement