MagmaLP

test 2. pc

Jan 26th, 2021 (edited)
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.51 KB | None | 0 0
  1. mon = peripheral.wrap("back")
  2. mon.setTextScale(1.5)
  3. sleep(2)
  4.  
  5. --Hilfsfunktionen--
  6.  
  7. function color(color)
  8.     mon.setTextColor(color)
  9. end
  10.  
  11. function pos(gap, line)
  12.     mon.setCursorPos(gap1,line1)
  13. end
  14.  
  15. function msg(gap, line, color, groundb, text)
  16.     if color == 1 then
  17.         color = 1
  18.     elseif color == 02 then
  19.         color = 2
  20.     elseif color == 03 then
  21.         color = 4
  22.     elseif color == 04 then
  23.         color = 8
  24.     elseif color == 05 then
  25.         color = 16
  26.     elseif color == 06 then
  27.         color = 32
  28.     elseif color == 07 then
  29.         color = 64
  30.     elseif color == 08 then
  31.         color = 128
  32.     elseif color == 09 then
  33.         color = 256
  34.     elseif color == 10 then
  35.         color = 512
  36.     elseif color == 11 then
  37.         color = 1024
  38.     elseif color == 12 then
  39.         color = 2048
  40.     elseif color == 13 then
  41.         color = 4096
  42.     elseif color == 14 then
  43.         color = 8192
  44.     elseif color == 15 then
  45.         color = 16384
  46.     elseif color == 16 then
  47.         color = 32768
  48.     end
  49.     if groundb == 1 then
  50.         groundb = 1
  51.     elseif groundb == 02 then
  52.         groundb = 2
  53.     elseif groundb == 03 then
  54.         groundb = 4
  55.     elseif groundb == 04 then
  56.         groundb = 8
  57.     elseif groundb == 05 then
  58.         groundb = 16
  59.     elseif groundb == 06 then
  60.         groundb = 32
  61.     elseif groundb == 07 then
  62.         groundb = 64
  63.     elseif groundb == 08 then
  64.         groundb = 128
  65.     elseif groundb == 09 then
  66.         groundb = 256
  67.     elseif groundb == 10 then
  68.         groundb = 512
  69.     elseif groundb == 11 then
  70.         groundb = 1024
  71.     elseif groundb == 12 then
  72.         groundb = 2048
  73.     elseif groundb == 13 then
  74.         groundb = 4096
  75.     elseif groundb == 14 then
  76.         groundb = 8192
  77.     elseif groundb == 15 then
  78.         groundb = 16384
  79.     elseif groundb == 16 then
  80.         groundb = 32768
  81.     end
  82.  
  83.     mon.setBackgroundColor(groundb)
  84.     mon.setCursorPos(gap,line)
  85.     mon.setTextColor(color)
  86.     text = mon.write(text)
  87. end
  88.  
  89. while true do
  90.  
  91. --Farbbelegungs Button--------------------------
  92.     msg(01,20,16,01,"                ")
  93.     msg(01,21,16,01,"  Farbbelegung  ")
  94.     msg(01,22,16,01,"                ")
  95.     mon.setBackgroundColor(colors.black)
  96.  
  97.     event, side, X, Y = os.pullEvent("monitor_touch")
  98.     if X >= 1 and X <= 16 and Y >= 20 and Y <= 22 and side == "back" then
  99.         shell.run("wires")
  100.     else
  101.         sleep(0.5)
  102.     end
  103. ------------------------------------------------
  104.  
  105. sleep(0.5)
  106. end
Add Comment
Please, Sign In to add comment