MagmaLP

Untitled

Apr 3rd, 2021 (edited)
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2. local s = sensor.wrap("top")
  3. rednet.open("right")
  4. mon = peripheral.wrap("left")
  5. mon.setBackgroundColor(32768)
  6. mon.setTextScale(1.5)
  7. mon.clear()
  8.  
  9. function msg(gap, line, color, groundb, text)
  10.     if color == 1 then
  11.         color = 1
  12.     elseif color == 02 then
  13.         color = 2
  14.     elseif color == 03 then
  15.         color = 4
  16.     elseif color == 04 then
  17.         color = 8
  18.     elseif color == 05 then
  19.         color = 16
  20.     elseif color == 06 then
  21.         color = 32
  22.     elseif color == 07 then
  23.         color = 64
  24.     elseif color == 08 then
  25.         color = 128
  26.     elseif color == 09 then
  27.         color = 256
  28.     elseif color == 10 then
  29.         color = 512
  30.     elseif color == 11 then
  31.         color = 1024
  32.     elseif color == 12 then
  33.         color = 2048
  34.     elseif color == 13 then
  35.         color = 4096
  36.     elseif color == 14 then
  37.         color = 8192
  38.     elseif color == 15 then
  39.         color = 16384
  40.     elseif color == 16 then
  41.         color = 32768
  42.     end
  43.  
  44.     if groundb == 1 then
  45.         groundb = 1
  46.     elseif groundb == 02 then
  47.         groundb = 2
  48.     elseif groundb == 03 then
  49.         groundb = 4
  50.     elseif groundb == 04 then
  51.         groundb = 8
  52.     elseif groundb == 05 then
  53.         groundb = 16
  54.     elseif groundb == 06 then
  55.         groundb = 32
  56.     elseif groundb == 07 then
  57.         groundb = 64
  58.     elseif groundb == 08 then
  59.         groundb = 128
  60.     elseif groundb == 09 then
  61.         groundb = 256
  62.     elseif groundb == 10 then
  63.         groundb = 512
  64.     elseif groundb == 11 then
  65.         groundb = 1024
  66.     elseif groundb == 12 then
  67.         groundb = 2048
  68.     elseif groundb == 13 then
  69.         groundb = 4096
  70.     elseif groundb == 14 then
  71.         groundb = 8192
  72.     elseif groundb == 15 then
  73.         groundb = 16384
  74.     elseif groundb == 16 then
  75.         groundb = 32768
  76.     end
  77.  
  78.     mon.setBackgroundColor(groundb)
  79.     mon.setCursorPos(gap,line)
  80.     mon.setTextColor(color)
  81.     text = mon.write(text)
  82. end
  83.  
  84. function sprachauswahl()
  85.     mon.setBackgroundColor(32768)
  86.     mon.clear()
  87.     msg(12,3,4,16,"Sprache / Language")
  88.     msg(8,06,1,6,"           ")     msg(23,06,1,6,"           ")
  89.     msg(8,07,1,6,"           ")     msg(23,07,1,6,"           ")
  90.     msg(8,08,1,6,"  Deutsch  ")     msg(23,08,1,6,"  English  ")
  91.     msg(8,09,1,6,"           ")     msg(23,09,1,6,"           ")
  92.     msg(8,10,1,6,"           ")     msg(23,10,1,6,"           ")
  93.  
  94.     local event, side, X, Y = os.pullEvent("monitor_touch")
  95.     if X >= 8 and X <=18 and Y >= 6 and Y <= 10 and side == "left" then
  96.         shell.run("deutsch")
  97.     elseif X >= 23 and X <=33 and Y >= 6 and Y <= 10 and side == "left" then
  98.         shell.run("english")
  99.     end
  100. end
  101.  
  102. while true do
  103.     msg(01,4,10,16,"Player detection,")
  104.     msg(01,5,10,16,"just klick on the Button.")
  105.     msg(01,7,10,16,"Spieler Erkennung,")
  106.     msg(01,8,10,16,"klick einfach auf den Knopf.")
  107.    
  108.     msg(17,10,16,01,"        ")
  109.     msg(17,11,16,01,"        ")
  110.     msg(17,12,16,01,"        ")
  111.  
  112.     msg(13,11,1,16,"-->")
  113.     msg(26,11,1,16,"<--")
  114.  
  115.     local event, side, X, Y = os.pullEvent("monitor_touch")
  116.     if X >= 17 and X <=24 and Y >= 10 and Y <= 12 and side == "left" then
  117.        
  118.   for name,info in pairs(s.getTargets()) do
  119.             local file = fs.open("Player", "w")
  120.             file.write(name)
  121.             file.close()
  122.             sprachauswahl()
  123.         end
  124.  
  125.     end
  126.     sleep(1)
  127. end
Add Comment
Please, Sign In to add comment