MagmaLP

Untitled

May 21st, 2021 (edited)
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. side = "left" --Bildschirmseite
  2. mon = peripheral.wrap(side)
  3. mon.setBackgroundColor(32768)
  4. mon.setTextScale(3)
  5. mon.clear()
  6.  
  7.  
  8. --Hilfs-Funktionen--
  9.  
  10. function calc_color(color)
  11.     return math.pow(2, color - 1)
  12. end
  13.  
  14. function msg(gap, line, color, groundb, text)
  15.     mon.setBackgroundColor(calc_color(groundb))
  16.     mon.setCursorPos(gap,line)
  17.     mon.setTextColor(calc_color(color))
  18.     text = mon.write(text)
  19. end
  20.  
  21.  
  22. --Haupt-Funktionen--
  23.  
  24. function input()
  25.     mon.setBackgroundColor(32768)
  26.     mon.clear()
  27.     msg(05,1,5,16,"Trading Machine")
  28.     msg(05,2,5,16,"~~~~~~~~~~~~~~~")
  29.     msg(01,3,9,16,"Ready to insert Items.")
  30.     msg(01,5,9,16,"Please dont through more")
  31.     msg(01,6,9,16,"then 16 Stacks inside.")
  32. end
  33.  
  34. function counting()
  35.     mon.setBackgroundColor(32768)
  36.     mon.clear()
  37.     msg(05,1,5,16,"Trading Machine")
  38.     msg(03,3,5,16,"Counting your Items")
  39.     i = 10
  40.     while i > 0 do
  41.       msg(11,4,10,16," "..i.." ")
  42.       i = i - 1
  43.       sleep(0.9)
  44.     end
  45. end
  46.  
  47. function choose()
  48.     mon.setBackgroundColor(32768)
  49.     mon.clear()
  50.     msg(05,1,5,16,"Trading Machine")
  51.     msg(05,2,5,16,"~~~~~~~~~~~~~~~")
  52.     msg(01,3,9,16,"Now choose a type of")
  53.     msg(01,4,9,16,"item, that you want to")
  54.     msg(01,5,9,16,"get for your stuff.")
  55. end
  56.  
  57. function restart()
  58.     mon.setBackgroundColor(32768)
  59.     mon.clear()
  60.     msg(05,1,05,16,"Trading Machine")  
  61.     msg(05,2,05,16,"~~~~~~~~~~~~~~~")
  62.     msg(01,3,05,16,"System is restarting,")
  63.     msg(01,4,10,16,"wait")
  64.     i = 16
  65.     while i > 0 do
  66.       msg(06,4,10,16,""..i.." seconds   ")
  67.       i = i - 1
  68.       sleep(1)
  69.     end
  70. end
  71.  
  72. input()
  73. while true do
  74.     if rs.getInput("bottom") then
  75.         sleep(0.5)
  76.         counting()
  77.         choose()
  78.     end
  79.     if rs.getInput("top") then
  80.         sleep(0.5)
  81.         restart()
  82.         shell.run("startup")
  83.     end
  84.     sleep(0.5)
  85. end
Add Comment
Please, Sign In to add comment