Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local image = require("image")
- local com =require("component")
- local gpu =com.gpu
- local pc =require("computer")
- modem =com.modem
- local GUI = require("GUI")
- local event = require("event")
- local term =require("term")
- local w, h = gpu.getResolution()
- gpu.setBackground(0xFFFFFF)
- local distance,olddistance,msg,oldmsg
- local history = {}
- local n = 1
- local b = 2
- local scrl = 1
- local txt =""
- local name =""
- local contacts = {"1032677a-453d-4059-ba3e-c005761b3e55","marko_rus","8199a046-62bf-4274-9eb7-3adf74ae2f93","marko_rus2"}
- gpu.fill(1, 1, w, h, " ")
- image.draw(35, 10, image.load("/tpchat/bin/pic/logofinal.pic"))
- gpu.setBackground(0xFFFFFF)
- gpu.setForeground(0x00FFFF)
- print(" Team Poligon Chat pre-release v0.214")
- print("открытие порта...")
- modem.open(142)
- print("инициализация")
- local mainContainer = GUI.fullScreenContainer()
- mainContainer:addChild(GUI.panel(1, 1, mainContainer.width, mainContainer.height, 0x2D2D2D))
- mainContainer:addChild(GUI.input(2, 2, 30, 3, 0xEEEEEE, 0x555555, 0x999999, 0xFFFFFF, 0x2D2D2D, "Hello world", "Placeholder text")).onInputFinished = function()
- GUI.alert("Input finished!")
- end
- os.sleep(2,5)
- print(" ну чё, стартанём?")
- os.sleep(1)
- gpu.setBackground(0x222222)
- gpu.fill(1,1,w,h," ")
- term.setCursor(1,1)
- pc.beep(1000)
- while true do
- term.setCursor(1,1)
- term.clearLine()
- --print("Введите сообщение: " ..txt)
- mainContainer: drawOnScreen ( true )
- mainContainer: startEventHandling (0,1)
- print("123")
- _,_,adr,_,distance,msg = event.pull(0,1 ,"modem_message")
- if msg and distance then
- pc.beep(500)
- while contacts[b] do
- if contacts[b-1] == adr then
- name = contacts[b]
- break
- end
- b =b+2
- end
- b = 2
- history[n] = name ..": " ..msg .." (в ".. math.ceil(distance) .."м от вас )"
- term.clear()
- ---end
- term.setCursor(1,30)
- for i=1, 21 do
- if history[n-21+i] then
- print(history[n-21+i])
- end
- end
- ---print(adr ..": " ..history[n] .." (в ".. math.ceil(distance) .."м от вас )")
- n = n+1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement