Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term = require("term")
- shell = require("shell")
- internet = require("internet")
- keyboard = require("keyboard")
- event = require("event")
- os = require("os")
- component = require("component")
- modem = component.getPrimary("modem")
- gpu = component.getPrimary("gpu")
- term = require("term")
- colors = require("colors")
- fs = require("filesystem")
- event = require("event")
- textutils = require("serialization")
- computer = require("computer")
- beep = component.getPrimary("computer")
- jenisis = {}
- function jenisis.drawScreen(staticScreen, tableScreen)
- running = true
- rkeyp = true
- cselected = 1
- num = 1
- static = true
- while running == true do
- term.clear()
- term.setCursor(1, 1)
- rkeyp = true
- isPrint = true
- num = 1
- static = true
- staticNum = 1
- param = "nulll"
- while static == true do
- line = staticScreen[staticNum]
- if line ~= nil then
- print(line)
- staticNum = staticNum + 1
- else
- static = false
- end
- end
- num = 1
- print(" ")
- while isPrint == true do
- line = tableScreen[num]
- if line ~= nil and num ~= cselected then
- print(line)
- num = num + 1
- elseif line ~= nil and num == cselected then
- print("["..line.."]")
- num = num + 1
- else
- isPrint = false
- end
- end
- while rkeyp == true do
- ev, p1, p2, key = event.pull(5, "key_down")
- if key == 200 then
- cselected = cselected - 1
- if cselected <= 0 then
- cselected = num - 1
- end
- rkeyp = false
- elseif key == 208 then
- cselected = cselected + 1
- if cselected >= num then
- cselected = 1
- end
- rkeyp = false
- elseif key == 28 then
- return cselected
- elseif key == 15 then
- return 999
- end
- end
- end
- end
- scrX, scrY = gpu.getResolution()
- term.setCursorPos = term.setCursor
- textutils.serialise = textutils.serialize
- textutils.unserialise = textutils.unserialize
- if gpu.maxDepth() > 1 then
- greenbar = 0x00ff00
- redbar = 0xff0000
- else
- greenbar = 0xffffff
- redbar = 0xffffff
- end
- modem.open(1024)
- function jenisis.receive()
- event_ = {event.pull("modem_message")}
- return event_[6]
- end
- function jenisis.broadcast(transmes)
- modem.broadcast(1024, transmes)
- end
- function greenBar()
- gpu.setBackground(greenbar)
- term.write(string.rep(" ", scrX))
- gpu.setBackground(0x000000)
- end
- function redBar()
- gpu.setBackground(redbar)
- term.write(string.rep(" ", scrX))
- gpu.setBackground(0x000000)
- end
- function jenisis.inputBar(prompt, hidden)
- term.setCursorPos(1, scrY - 2)
- term.clearLine()
- term.setCursorPos(1, scrY - 1)
- term.clearLine()
- term.setCursorPos(1, scrY - 3)
- greenBar()
- term.setCursorPos(1, scrY)
- greenBar()
- term.setCursorPos(1, scrY - 2)
- term.write(prompt)
- term.setCursorPos(1, scrY - 1)
- if hidden then
- info = term.read({}, true, {}, "*")
- else
- info = term.read()
- end
- beep.beep(1000, 0.3)
- return info
- end
- function jenisis.errorMes(message, barColor)
- if barColor == "green" then
- printBar = greenBar
- else
- printBar = redBar
- end
- term.setCursorPos(1, (scrY / 2) + 2)
- printBar()
- term.setCursorPos(1, (scrY / 2) + 4)
- printBar()
- term.setCursorPos(math.floor((scrX / 2) - (#message / 2)), (scrY / 2) + 3)
- term.write(message)
- beep.beep(1000, 0.3)
- event.pull("key")
- end
- return jenisis
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement