Advertisement
MagmaLP

Einzahl-Computer Startup

Mar 31st, 2021 (edited)
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.94 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. local s = sensor.wrap("top")
  3. rednet.open("front")
  4. mon = peripheral.wrap("back")
  5. mon.setBackgroundColor(32768)
  6. mon.setTextScale(1.5)
  7. mon.clear()
  8. side = "back"
  9.  
  10. function calc_color(color)
  11.     return math.pow(2, color - 1)
  12. end
  13. function msg(gap, line, color, groundb, text)
  14.     mon.setBackgroundColor(calc_color(groundb))
  15.     mon.setCursorPos(gap,line)
  16.     mon.setTextColor(calc_color(color))
  17.     text = mon.write(text)
  18. end
  19.  
  20. function sprachauswahl()
  21.     mon.setBackgroundColor(32768)
  22.     mon.clear()
  23.     msg(12,3,4,16,"Sprache / Language")
  24.     msg(8,07,1,6,"           ")     msg(23,07,1,6,"           ")
  25.     msg(8,08,1,6,"           ")     msg(23,08,1,6,"           ")
  26.     msg(8,09,1,6,"  Deutsch  ")     msg(23,09,1,6,"  English  ")
  27.     msg(8,10,1,6,"           ")     msg(23,10,1,6,"           ")
  28.     msg(8,11,1,6,"           ")     msg(23,11,1,6,"           ")
  29.  
  30.     local event, side, X, Y = os.pullEvent("monitor_touch")
  31.     if X >= 01 and X <=40 and Y >= 1 and Y <= 6 and side == side then
  32.         sprachauswahl()
  33.     elseif X >= 01 and X <=07 and Y >= 7 and Y <= 11 and side == side then
  34.         sprachauswahl()
  35.     elseif X >= 19 and X <=22 and Y >= 7 and Y <= 11 and side == side then
  36.         sprachauswahl()
  37.     elseif X >= 34 and X <=40 and Y >= 7 and Y <= 11 and side == side then
  38.         sprachauswahl()
  39.     elseif X >= 01 and X <=40 and Y >= 12 and Y <= 17 and side == side then
  40.         sprachauswahl()
  41.  
  42.     elseif X >= 8 and X <=18 and Y >= 7 and Y <= 11 and side == side then
  43.         shell.run("deutsch")
  44.     elseif X >= 23 and X <=33 and Y >= 7 and Y <= 11 and side == side then
  45.         shell.run("english")
  46.     end
  47. end
  48.  
  49. function start()
  50.     mon.setBackgroundColor(32768)
  51.     mon.clear()
  52.     msg(12,4,10,16,"Player detection,")
  53.     msg(8,5,10,16,"just klick on the Button.")
  54.     msg(12,7,10,16,"Spieler Erkennung,")
  55.     msg(8,8,10,16,"klick einfach auf den Knopf.")
  56.    
  57.     msg(17,10,16,01,"        ")
  58.     msg(17,11,16,01,"        ")
  59.     msg(17,12,16,01,"        ")
  60.  
  61.     msg(13,11,1,16,"-->")
  62.     msg(26,11,1,16,"<--")
  63.  
  64.     msg(2,14,5,15," Nicht vergessen am Ende Auszuloggen!")
  65.     msg(2,15,5,15," Don't forget to log out at the end! ")
  66.  
  67.     local event, side, X, Y = os.pullEvent("monitor_touch")
  68.     if X >= 01 and X <=40 and Y >= 01 and Y <= 09 and side == side then
  69.         start()
  70.     elseif X >= 01 and X <=16 and Y >= 10 and Y <= 12 and side == side then
  71.         start()
  72.     elseif X >= 25 and X <=40 and Y >= 10 and Y <= 12 and side == side then
  73.         start()
  74.     elseif X >= 01 and X <=40 and Y >= 13 and Y <= 17 and side == side then
  75.         start()
  76.  
  77.     elseif X >= 17 and X <=24 and Y >= 10 and Y <= 12 and side == side then  
  78.         for name,info in pairs(s.getTargets()) do
  79.             local file = fs.open("Player", "w")
  80.             file.write(name)
  81.             file.close()
  82.             sprachauswahl()
  83.         end
  84.     end
  85. end
  86.  
  87.  
  88. sleep(5)
  89. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement