MagmaLP

SMF-PC-Language-Selection

Apr 23rd, 2022 (edited)
1,388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. function calc_color(color)
  2.     return math.pow(2, color - 1)
  3. end
  4.  
  5. function msg(gap, line, color, groundb, text)
  6.     term.setBackgroundColor(calc_color(groundb))
  7.     term.setCursorPos(gap,line)
  8.     term.setTextColor(calc_color(color))
  9.     text = term.write(text)
  10. end
  11.  
  12. term.setBackgroundColor(32768)
  13. term.clear()
  14. msg(09,03,09,16,"Language-Selection - Sprachauswahl")
  15. msg(09,04,09,16,"~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~")
  16.  
  17. msg(13,08,01,15,"           ") msg(29,08,01,15,"           ")
  18. msg(13,09,01,15,"           ") msg(29,09,01,15,"           ")
  19. msg(13,10,01,15,"  English  ") msg(29,10,01,15,"  Deutsch  ")
  20. msg(13,11,01,15,"           ") msg(29,11,01,15,"           ")
  21. msg(13,12,01,15,"           ") msg(29,12,01,15,"           ")
  22.  
  23. local event, button, X, Y = os.pullEvent("mouse_click")
  24. if X >= 13 and X <= 23 and Y >= 8 and Y <= 12 then
  25.     file = fs.open("local_language" , "w")
  26.     file.write("EN")
  27.     file.close()
  28.     shell.run("Category_EN")
  29. elseif X >= 29 and X <= 39 and Y >= 8 and Y <= 12 then
  30.     file = fs.open("local_language" , "w")
  31.     file.write("DE")
  32.     file.close()
  33.     shell.run("Category_DE")
  34. else
  35.     os.reboot()
  36. end
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment