Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- --- Generated by EmmyLua(https://github.com/EmmyLua)
- --- Created by lol.
- --- DateTime: 23.12.2023 12:28
- ---
- local component = require("component")
- local computer=require("computer")
- local sides =require("sides")
- local colors =require("colors")
- local rs = component.redstone
- local term = require("term")
- local unicode = require("unicode")
- local fs = require("filesystem")
- local internet = require("internet")
- local g = component.gpu
- local back = 0xffffff
- local event = require("event")
- local shell = require("shell")
- local serial = require("serialization")
- local g = component.gpu
- local unicode = require("unicode")
- local term = require("term")
- local keyboard = require("keyboard")
- function
- mid(w,y,text) --Центровка
- local _,n = string.gsub(text, "&","")
- local l = unicode.len(text) - n * 2
- x = (w / 2) - (l / 2)
- text(x, y, text)
- end
- function
- setColor(index) --Список цветов
- if (index ~= "r") then back = g.getForeground() end
- if (index == "0") then g.setForeground(0x333333) end
- if (index == "1") then g.setForeground(0x0000ff) end
- if (index == "2") then g.setForeground(0x00ff00) end
- if (index == "3") then g.setForeground(0x24b3a7) end
- if (index == "4") then g.setForeground(0xff0000) end
- if (index == "5") then g.setForeground(0x8b00ff) end
- if (index == "6") then g.setForeground(0xffa500) end
- if (index == "7") then g.setForeground(0xbbbbbb) end
- if (index == "8") then g.setForeground(0x808080) end
- if (index == "9") then g.setForeground(0x0000ff) end
- if (index == "a") then g.setForeground(0x66ff66) end
- if (index == "b") then g.setForeground(0x00ffff) end
- if (index == "c") then g.setForeground(0xff6347) end
- if (index == "d") then g.setForeground(0xff00ff) end
- if (index == "e") then g.setForeground(0xffff00) end
- if (index == "f") then g.setForeground(0xffffff) end
- if (index == "g") then g.setForeground(0x00ff00) end
- if (index == "r") then g.setForeground(back) end
- end
- function
- text(x,y,text) --Цветной текст
- local n = 1
- for i = 1, unicode.len(text) do
- if unicode.sub(text, i,i) == "&" then
- setColor(unicode.sub(text, i + 1, i + 1))
- elseif unicode.sub(text, i - 1, i - 1) ~= "&" then
- g.set(x+n,y, unicode.sub(text, i,i))
- n = n + 1
- end
- end
- end
- function
- button(x,y,w,h,col1,col2,text) -- Кнопка
- g.set(x + w/2 - unicode.len(text)/2, y+h/2, text)
- for i = 1, w-2 do
- g.set(x+i,y,"─")
- g.set(x+i,y+h-1,"─")
- end
- for i = 1, h-2 do
- g.set(x,y+i,"│")
- g.set(x+w-1,y+i,"│")
- end
- g.set(x,y,"┌")
- g.set(x+w-1,y,"┐")
- g.set(x,y+h-1,"└")
- g.set(x+w-1,y+h-1,"┘")
- end
- function
- mathRound(roundIn , roundDig) --Округлить число
- local mul = math.pow(10, roundDig)
- return ( math.floor(( roundIn * mul) + 0.5)/mul)
- end
- function
- hex(Hcolor) --Конвертация Dec в Hex
- local hex = "000000" .. string.format('%x', Hcolor)
- hex = string.sub(hex, unicode.len(hex)-5, unicode.len(hex))
- return hex
- end
- function
- dec(Dcolor) --Конвертация Hex в Dec
- if Dcolor == "" then
- Dcolor = "ffffff"
- end
- local dec = string.format('%d', '0x'.. Dcolor)
- return tonumber(dec)
- end
- function
- pressButton(Pw,Ph,mass)
- local x,y,w,h = mass[1], mass[2], mass[3], mass[4]
- if Pw>=x and Pw<=x+w-1 and Ph>=y and Ph<=y+h-1 then
- return true
- end
- return false
- end
- function
- drawButton(mass)
- local x,y,w,h,text,col1,col2 = mass[1], mass[2], mass[3], mass[4], mass[5], mass[6], mass[7]
- g.fill(x,y,w,h," ")
- g.setForeground(col1)
- g.set(x + w/2 - unicode.len(text)/2, y+h/2, text)
- g.setForeground(col2)
- for i = 1, w-2 do
- g.set(x+i,y,"─")
- g.set(x+i,y+h-1,"─")
- end
- for i = 1, h-2 do
- g.set(x,y+i,"│")
- g.set(x+w-1,y+i,"│")
- end
- g.set(x,y,"┌")
- g.set(x+w-1,y,"┐")
- g.set(x,y+h-1,"└")
- g.set(x+w-1,y+h-1,"┘")
- end
- local TONE = 600
- local nick1 = "ВИСКАС"
- --- НАЧАЛО СКРИПТА=================================================================================================================
- while true do
- term.clear()
- button(20,7,10,3,0x000000,0x00ff00," ПУСК ")
- local e,_,x,y,_,nick = event.pull("touch")
- computer.addUser(nick)
- if e == "touch" then
- g.set(1,3,"нажал")
- computer.beep(TONE, 0.1)
- if x>=20 and x<=30 and y>=6 and y<=11 and rs.getInput(sides.bottom) <= 0 then
- g.set(1,4,"пук-среньк- я нажал без редстоуна")
- computer.addUser(nick)
- nick1 = nick
- g.set(1,6,"кто нажал кнопку: - " .. nick1)
- print("СИЛА СИГНАЛА" .. rs.getInput(sides.bottom).. " БЛОКОФ")
- os.sleep(1)
- end
- if x>=20 and x<=30 and y>=6 and y<=11 and rs.getInput(sides.bottom)>0 then
- g.set(1,4,"пук-среньк- я нажал C редстоуном")
- computer.addUser(nick)
- nick1 = nick
- g.set(1,6,"кто нажал кнопку: - " .. nick1)
- print("СИЛА СИГНАЛА - " .. rs.getInput(sides.bottom).. " БЛОКОФ")
- os.sleep(1)
- end
- end
- local users={computer.users()}
- for i=1, #users do
- computer.removeUser(users[i])
- end
- g.set(1,15,"конец телепорта")
- os.sleep(0,2)
- end
- ----------------
- --
- --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement