Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- lights = false
- door = false
- Help = false
- show = true
- local p = peripheral.wrap("top")
- local bgcol = 0xFF0000
- local txtcol = 0x00FFFF
- sen = sensor.wrap("sensor_11")
- function error(msg)
- p.clear()
- mybox = p.addBox(1,1, 100, 50, bgcol, 0.5)
- local w = mybox.getX()
- mytext = p.addText(50, 10, tostring(msg), txtcol)
- end
- function bydoor()
- p.clear()
- mybox = p.addBox(1,1, 100, 50, bgcol, 0.5)
- mytext = p.addText(1, 1, "By Door:", txtcol)
- for i, v in pairs(sen.getTargets()) do
- mytext = p.addText(1,10, i, txtcol)
- end
- sleep(5)
- start()
- end
- function help()
- p.clear()
- p.clear()
- mybox = p.addBox(1,1, 120, 150, bgcol, 0.5)
- mytext = p.addText(1, 10, "Help", txtcol)
- mytext = p.addText(1, 20, "Shows or hides the help", txtcol)
- mytext = p.addText(1, 40, "=1+1", txtcol)
- mytext = p.addText(1, 50, "Shows what 1+1 is,", txtcol)
- mytext = p.addText(1, 60, "Works with any number", txtcol)
- mytext = p.addText(1, 70, "and operator", txtcol)
- mytext = p.addText(1, 90, "Hide / Show", txtcol)
- mytext = p.addText(1, 100, "Hides or shows the", txtcol)
- mytext = p.addText(1, 110, "overlay", txtcol)
- end
- function start()
- p.clear()
- mybox = p.addBox(1,1, 100, 50, bgcol, 0.5)
- mytext = p.addText(1, 1, "Version: 1.0", txtcol)
- mytext = p.addText(1, 20, "Try $$help", txtcol)
- end
- start()
- while true do
- _, p1 = os.pullEvent("chat_command")
- if p1 == "help" then
- if show then
- if Help then
- Help = false
- start()
- else
- Help = true
- help()
- end
- end
- if string.find(p1, "=") then
- if show then
- txt = (tostring(p1):match("=(.+)"))
- num = loadstring("return "..txt)()
- mytext = p.addText(1, 40, tostring(num), textcol)
- sleep(5)
- start()
- end
- end
- if string.find(p1, "reverse ") then
- if show then
- txt = tostring(p1):match("reverse(.+)")
- num = string.reverse(txt)
- mytext = p.addText(1, 40, tostring(num), txtcol)
- sleep(5)
- start()
- end
- end
- elseif p1 == "hide" then
- if show then
- p.clear()
- show = false
- end
- elseif p1 == "show" then
- if not show then
- show = true
- start()
- end
- elseif p1 == "bydoor" then
- if show then
- bydoor()
- end
- else
- if not show then
- error("Error!")
- sleep(1)
- start()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement