Advertisement
mrWhiskasss

Скрипт гамна для марка

Dec 23rd, 2023
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.56 KB | None | 0 0
  1. ---
  2. --- Generated by EmmyLua(https://github.com/EmmyLua)
  3. --- Created by lol.
  4. --- DateTime: 23.12.2023 12:28
  5. ---
  6.  
  7. local component = require("component")
  8. local computer=require("computer")
  9. local sides =require("sides")
  10. local colors =require("colors")
  11. local rs = component.redstone
  12. local term = require("term")
  13. local unicode = require("unicode")
  14. local fs = require("filesystem")
  15. local internet = require("internet")
  16. local g = component.gpu
  17. local back = 0xffffff
  18. local event = require("event")
  19. local shell = require("shell")
  20. local serial = require("serialization")
  21. local g = component.gpu
  22. local unicode = require("unicode")
  23. local term = require("term")
  24. local keyboard = require("keyboard")
  25.  
  26. function
  27. mid(w,y,text) --Центровка
  28. local _,n = string.gsub(text, "&","")
  29. local l = unicode.len(text) - n * 2
  30. x = (w / 2) - (l / 2)
  31.  
  32. text(x, y, text)
  33. end
  34.  
  35. function
  36. setColor(index) --Список цветов
  37. if (index ~= "r") then back = g.getForeground() end
  38. if (index == "0") then g.setForeground(0x333333) end
  39. if (index == "1") then g.setForeground(0x0000ff) end
  40. if (index == "2") then g.setForeground(0x00ff00) end
  41. if (index == "3") then g.setForeground(0x24b3a7) end
  42. if (index == "4") then g.setForeground(0xff0000) end
  43. if (index == "5") then g.setForeground(0x8b00ff) end
  44. if (index == "6") then g.setForeground(0xffa500) end
  45. if (index == "7") then g.setForeground(0xbbbbbb) end
  46. if (index == "8") then g.setForeground(0x808080) end
  47. if (index == "9") then g.setForeground(0x0000ff) end
  48. if (index == "a") then g.setForeground(0x66ff66) end
  49. if (index == "b") then g.setForeground(0x00ffff) end
  50. if (index == "c") then g.setForeground(0xff6347) end
  51. if (index == "d") then g.setForeground(0xff00ff) end
  52. if (index == "e") then g.setForeground(0xffff00) end
  53. if (index == "f") then g.setForeground(0xffffff) end
  54. if (index == "g") then g.setForeground(0x00ff00) end
  55. if (index == "r") then g.setForeground(back) end
  56. end
  57.  
  58. function
  59. text(x,y,text) --Цветной текст
  60. local n = 1
  61. for i = 1, unicode.len(text) do
  62. if unicode.sub(text, i,i) == "&" then
  63.  
  64. setColor(unicode.sub(text, i + 1, i + 1))
  65. elseif unicode.sub(text, i - 1, i - 1) ~= "&" then
  66. g.set(x+n,y, unicode.sub(text, i,i))
  67. n = n + 1
  68. end
  69. end
  70. end
  71.  
  72. function
  73. button(x,y,w,h,col1,col2,text) -- Кнопка
  74.  
  75. g.set(x + w/2 - unicode.len(text)/2, y+h/2, text)
  76.  
  77. for i = 1, w-2 do
  78. g.set(x+i,y,"─")
  79. g.set(x+i,y+h-1,"─")
  80. end
  81. for i = 1, h-2 do
  82. g.set(x,y+i,"│")
  83. g.set(x+w-1,y+i,"│")
  84. end
  85. g.set(x,y,"┌")
  86. g.set(x+w-1,y,"┐")
  87. g.set(x,y+h-1,"└")
  88. g.set(x+w-1,y+h-1,"┘")
  89. end
  90.  
  91.  
  92. function
  93. mathRound(roundIn , roundDig) --Округлить число
  94. local mul = math.pow(10, roundDig)
  95. return ( math.floor(( roundIn * mul) + 0.5)/mul)
  96. end
  97.  
  98.  
  99.  
  100.  
  101.  
  102. function
  103. hex(Hcolor) --Конвертация Dec в Hex
  104. local hex = "000000" .. string.format('%x', Hcolor)
  105. hex = string.sub(hex, unicode.len(hex)-5, unicode.len(hex))
  106. return hex
  107. end
  108.  
  109. function
  110. dec(Dcolor) --Конвертация Hex в Dec
  111. if Dcolor == "" then
  112. Dcolor = "ffffff"
  113. end
  114. local dec = string.format('%d', '0x'.. Dcolor)
  115. return tonumber(dec)
  116. end
  117.  
  118.  
  119.  
  120.  
  121. function
  122. pressButton(Pw,Ph,mass)
  123. local x,y,w,h = mass[1], mass[2], mass[3], mass[4]
  124. if Pw>=x and Pw<=x+w-1 and Ph>=y and Ph<=y+h-1 then
  125. return true
  126. end
  127. return false
  128. end
  129.  
  130. function
  131. drawButton(mass)
  132. local x,y,w,h,text,col1,col2 = mass[1], mass[2], mass[3], mass[4], mass[5], mass[6], mass[7]
  133. g.fill(x,y,w,h," ")
  134. g.setForeground(col1)
  135. g.set(x + w/2 - unicode.len(text)/2, y+h/2, text)
  136. g.setForeground(col2)
  137. for i = 1, w-2 do
  138. g.set(x+i,y,"─")
  139. g.set(x+i,y+h-1,"─")
  140. end
  141. for i = 1, h-2 do
  142. g.set(x,y+i,"│")
  143. g.set(x+w-1,y+i,"│")
  144. end
  145. g.set(x,y,"┌")
  146. g.set(x+w-1,y,"┐")
  147. g.set(x,y+h-1,"└")
  148. g.set(x+w-1,y+h-1,"┘")
  149. end
  150.  
  151. local TONE = 600
  152. local nick1 = "ВИСКАС"
  153. --- НАЧАЛО СКРИПТА=================================================================================================================
  154.  
  155.  
  156. while true do
  157. term.clear()
  158. button(20,7,10,3,0x000000,0x00ff00," ПУСК ")
  159.  
  160.  
  161. local e,_,x,y,_,nick = event.pull("touch")
  162. computer.addUser(nick)
  163. if e == "touch" then
  164. g.set(1,3,"нажал")
  165. computer.beep(TONE, 0.1)
  166. if x>=20 and x<=30 and y>=6 and y<=11 and rs.getInput(sides.bottom) <= 0 then
  167. g.set(1,4,"пук-среньк- я нажал без редстоуна")
  168. computer.addUser(nick)
  169. nick1 = nick
  170. g.set(1,6,"кто нажал кнопку: - " .. nick1)
  171. print("СИЛА СИГНАЛА" .. rs.getInput(sides.bottom).. " БЛОКОФ")
  172. os.sleep(1)
  173. end
  174.  
  175. if x>=20 and x<=30 and y>=6 and y<=11 and rs.getInput(sides.bottom)>0 then
  176. g.set(1,4,"пук-среньк- я нажал C редстоуном")
  177. computer.addUser(nick)
  178. nick1 = nick
  179. g.set(1,6,"кто нажал кнопку: - " .. nick1)
  180. print("СИЛА СИГНАЛА - " .. rs.getInput(sides.bottom).. " БЛОКОФ")
  181. os.sleep(1)
  182. end
  183.  
  184. end
  185. local users={computer.users()}
  186. for i=1, #users do
  187. computer.removeUser(users[i])
  188. end
  189. g.set(1,15,"конец телепорта")
  190. os.sleep(0,2)
  191. end
  192.  
  193. ----------------
  194.  
  195. --
  196.  
  197. --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement