Advertisement
MagmaLP

Trading PC EN in der mitte

May 20th, 2021 (edited)
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  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. 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.  
  21. --Haupt-Funktionen--
  22.  
  23. function mainscreen()
  24.     mon.setBackgroundColor(32768)
  25.     mon.clear()
  26.     msg(05,1,5,16,"Trading Machine")
  27.     msg(01,3,9,16,"Dont throw more then 16")
  28.     msg(01,4,9,16,"stack per item type")
  29.     msg(01,5,9,16,"into the *****.")
  30.     msg(10,5,6,16,"Input")
  31. end
  32.  
  33. function counting()
  34.     mon.setBackgroundColor(32768)
  35.     mon.clear()
  36.     msg(05,1,5,16,"Trading Machine")
  37.     msg(03,3,5,16,"Counting your Items")
  38.     msg(12,4,10,16,"10")
  39.     sleep(0.9)
  40.     msg(12,4,10,16,"9 ")
  41.     sleep(0.9)
  42.     msg(12,4,10,16,"8 ")
  43.     sleep(0.9)
  44.     msg(12,4,10,16,"7 ")
  45.     sleep(0.9)
  46.     msg(12,4,10,16,"6 ")
  47.     sleep(0.9)
  48.     msg(12,4,10,16,"5 ")
  49.     sleep(0.9)
  50.     msg(12,4,10,16,"4 ")
  51.     sleep(0.9)
  52.     msg(12,4,10,16,"3 ")
  53.     sleep(0.9)
  54.     msg(12,4,10,16,"2 ")
  55.     sleep(0.9)
  56.     msg(12,4,10,16,"1 ")
  57.     sleep(0.9)
  58. end
  59.  
  60. function output()
  61.     mon.setBackgroundColor(32768)
  62.     mon.clear()
  63.     msg(05,1,5,16,"Trading Machine")
  64.     msg(01,3,9,16,"Now choose a type of")
  65.     msg(01,4,9,16,"item, that you want to")
  66.     msg(01,5,9,16,"get for your stuff.")
  67. end
  68.  
  69.  
  70. mainscreen()
  71. while true do
  72.     if rs.getInput("bottom") then
  73.         sleep(0.5)
  74.         counting()
  75.         output()
  76.     end
  77.     sleep(0.5)
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement