Advertisement
pepeknamornik

hzs.lua

Jun 10th, 2021
868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.14 KB | None | 0 0
  1. local verze = "21.0610.R1"
  2. local anim = 0.1
  3. local w, h = term.getSize()
  4. local page = "main"
  5. local kabel = "bottom"
  6. local poplach = false
  7. local i = 0
  8. local j = 0
  9.  
  10. local popbar = 0
  11. ----------------------------------------------------
  12. local f=fs.open("/C/system/RAM/user","r")
  13. user=f.readLine()
  14. pass=f.readLine()
  15. Fname=f.readLine()
  16. Lname=f.readLine()
  17. f.close()
  18.  
  19. function ukonceni ()
  20.     fs.delete (RamCesta)
  21.     error()
  22. end
  23.  
  24. function cbarva()
  25. lista.setTextColor(colors.black)
  26. lista.setBackgroundColor(colors.gray)
  27. end
  28.  
  29. function defaultvalue()
  30. end
  31.  
  32. function start()
  33. defaultvalue()
  34. local myWindow = window.create(term.current(),w/2-11,h/2-5,25,9)
  35. myWindow.setBackgroundColor(colors.orange)
  36. myWindow.setTextColor(colors.black)
  37. myWindow.clear()
  38. myWindow.setCursorPos (8, 5)
  39. myWindow.write"HZS Software"
  40. myWindow.setCursorPos (1, 9)
  41. myWindow.write(verze)
  42. myWindow.setCursorPos (1, 1)
  43. myWindow.write"Pepek@Soft"
  44. myWindow.setCursorPos (22, 9)
  45. myWindow.write"2021"
  46. sleep(1)
  47. menu()
  48. end
  49.  
  50. function plocha()
  51. w, h = term.getSize()
  52. paintutils.drawLine(1, 1, w, 1, colors.orange)
  53. paintutils.drawPixel (w,1, colors.red)
  54. term.setCursorPos (w,1)
  55. term.setTextColor(colors.black)
  56. write "*"
  57. pozadi = window.create(term.current(),1,2,w,h)
  58. pozadi.setBackgroundColor(colors.white)
  59. pozadi.setTextColor(colors.black)
  60. pozadi.clear()
  61. term.setBackgroundColor(colors.white)
  62. term.setTextColor(colors.lightGray)
  63. term.setCursorPos(1,h) write"Pepek@Soft"
  64. end
  65. -----------------------------------------------------------------------------
  66.  
  67. function main()
  68. pozadi.setTextColor(colors.black)
  69. pozadi.setCursorPos(2,2)
  70. pozadi.write"Stav: "
  71. pozadi.setBackgroundColor(colors.lightGray)
  72. pozadi.setCursorPos(w-13,4)
  73. pozadi.write(" Poplach! ")
  74. end
  75.  
  76. function poplachfun()  
  77.     if poplach then
  78.     popbar = 128
  79.     pozadi.setBackgroundColor(colors.red)
  80.     i = i+1
  81.     else
  82.     popbar = 0
  83.     pozadi.setBackgroundColor(colors.lightGray)
  84.     end
  85.    
  86.     pozadi.setCursorPos(w-13,4)
  87.     pozadi.write(" Poplach! ")
  88. end
  89.  
  90. function opakovani()
  91. poplachfun()
  92. red()
  93. cas()
  94. if (i==10) then i = 0 commands.exec("/tellraw @a [{\"text\":\"TEST! TEST! POZOR! POZARNI POPLACH! SVOLAVANI JEDNOTEK! -227 69 250\",\"color\":\"red\"}]</color></insert>") end
  95. end
  96.  
  97. function red ()
  98. local barvy = 0
  99.  
  100. barvy = popbar
  101.  
  102. redstone.setBundledOutput(kabel, barvy)
  103. end
  104.  
  105.  function cas()
  106.     term.setTextColor(colors.black)
  107.     term.setBackgroundColor(colors.orange)
  108.     if os.time() > 12 then
  109.     term.setCursorPos(2,1)
  110.     write(textutils.formatTime(os.time(), true))
  111.     else
  112.     term.setCursorPos(3, 1)
  113.     write(textutils.formatTime(os.time(), true))
  114.     end
  115. end
  116.  
  117. function menu()
  118.     plocha()
  119.     if (page == "main") then
  120.         main ()
  121.     end
  122.  
  123.     while true do
  124.         os.startTimer(1.5)
  125.         opakovani()
  126.        
  127.         local event, button, x, y = os.pullEvent()
  128.        
  129.         if event == "mouse_click" and x >= w-13 and x <= w and y == 5 then
  130.         poplach = not poplach
  131.         sleep(anim)
  132.         menu()
  133.         end
  134.        
  135.        
  136.         if x == w and y == 1 then
  137.             ukonceni ()
  138.         else
  139.             menu() -------- stejne jako nazev funkce
  140.         end
  141.     end
  142. end
  143.  
  144. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement