Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = require("player")
- player.playStartup()
- peripheral.find("modem", rednet.open)
- local basalt = require("modules/basalt")
- local bgColor = colors.lightBlue
- basalt.setTheme("BaseFrameBG", bgColor)
- basalt.setTheme("InputText", colors.white)
- local main = basalt.createFrame()
- local titleText = main:addLabel()
- titleText
- :setBackground(bgColor)
- :setText("MinerOS")
- :setFontSize(2)
- local x, y = titleText:getSize()
- local tx, ty = term.getSize()
- local titlePosX = math.floor(tx / 2 - x / 2) + 1
- local titlePosY = math.floor(ty / 2 - y / 2)
- titleText:setPosition(
- titlePosX,
- titlePosY
- )
- local password = main:addInput()
- password
- :setInputType("password")
- :setDefaultText("password")
- :setSize(x, 1)
- local px, py = password.getSize()
- password
- :setPosition(
- math.floor(tx / 2 - px / 2) + 1,
- math.floor(ty / 2 + y / 2)
- )
- local hint = main
- :addLabel()
- :setPosition(
- math.floor(tx / 2 - px / 2) + 1,
- math.floor(ty / 2 + y / 2) + 1
- )
- :hide()
- local pMessager = main:addProgram()
- pMessager:setSize(tx,ty)
- pMessager:execute("messager.lua")
- pMessager:setVisible(false)
- function startMessager()
- pMessager:setVisible(true)
- end
- password
- :onLoseFocus(function(self)
- if self:getValue() == "stoneblock" then
- startMessager()
- else
- hint
- :setText("Incorrect password")
- :setBackground(bgColor)
- :setForeground(colors.red)
- :show()
- end
- passValue = ""
- self:setValue("")
- end)
- basalt.autoUpdate()
Add Comment
Please, Sign In to add comment