drProfessorGTA

[OC]Lagerverwaltung

Dec 19th, 2020 (edited)
1,270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.79 KB | None | 0 0
  1. local component = require("component")
  2. local gpu = component.gpu
  3. local rs = component.redstone
  4. local w, h = gpu.getResolution()
  5. local mon = require("tty")
  6. local event = require("event")
  7. local side = require("sides")
  8. local color = require("colors")
  9.  
  10.  
  11. local best = ""
  12. local name = ""
  13. local prio = ""
  14.  
  15.  
  16.  
  17. function startseite()
  18.     mon.clear()
  19.  
  20.     gpu.setBackground(0x6E6E6E)
  21.     gpu.fill(1, 1, w, h, " ")
  22.    
  23.     gpu.setForeground(0xB40404)
  24.     mon.setCursor(w/2 - 7, 1)
  25.     print("Lagerverwaltung")
  26.     mon.setCursor(w/2 - 8, 2)
  27.     print("----------------")
  28.  
  29.     gpu.setBackground(0xDF0101)
  30.     gpu.fill(10, 10, 25, 7, " ")
  31.     gpu.setForeground(0x000000)
  32.     mon.setCursor(17, 13)
  33.     print("Bestellung")
  34.  
  35.     local klick = true
  36.  
  37.     while klick do
  38.         local _,_,x,y = event.pull("touch")
  39.         if x>9 and x<35 and y>9 and y<17 then
  40.             klick = false
  41.             gpu.setBackground(0x01DF01)
  42.             gpu.fill(10, 10, 25, 7, " ")
  43.             gpu.setForeground(0x000000)
  44.             mon.setCursor(17, 13)
  45.             print("Bestellung")
  46.             os.sleep(1)
  47.             bestellung()
  48.         end
  49.     end
  50. end
  51.  
  52. function bestellung()
  53.     mon.clear()
  54.  
  55.     gpu.setBackground(0x6E6E6E)
  56.     gpu.fill(1, 1, w, h, " ")
  57.     gpu.setForeground(0xB40404)
  58.     mon.setCursor(w/2 - 5, 1)
  59.     print("Bestellung")
  60.     mon.setCursor(w/2 - 6, 2)
  61.     print("------------")
  62.    
  63.     mon.setCursor(10, 10)
  64.     print("Bestellung:")
  65.     gpu.setBackground(0xFFFFFF)
  66.     gpu.fill(25, 9, w-35, 3, " ")
  67.     mon.setCursor(26, 10)
  68.     print(best)
  69.    
  70.     gpu.setBackground(0x6E6E6E)
  71.     mon.setCursor(10, 16)
  72.     print("Name:")
  73.     gpu.setBackground(0xFFFFFF)
  74.     gpu.fill(25, 15, 30, 3, " ")
  75.     mon.setCursor(26, 16)
  76.     print(name)
  77.    
  78.     gpu.setBackground(0x6E6E6E)
  79.     mon.setCursor(60, 16)
  80.     print("Priorität:")
  81.     gpu.setBackground(0xDF0101)
  82.     gpu.fill(75, 15, 20, 3, " ")
  83.     gpu.setForeground(0xFFFFFF)
  84.     mon.setCursor(83, 16)
  85.     print("HOCH")
  86.     gpu.setBackground(0xDF7401)
  87.     gpu.fill(100, 15, 20, 3, " ")
  88.     gpu.setForeground(0xFFFFFF)
  89.     mon.setCursor(107, 16)
  90.     print("MITTEL")
  91.     gpu.setBackground(0xD7DF01)
  92.     gpu.fill(125, 15, 20, 3, " ")
  93.     gpu.setForeground(0xFFFFFF)
  94.     mon.setCursor(132, 16)
  95.     print("NIEDRIG")
  96.    
  97.    
  98.     gpu.setBackground(0xDF0101)
  99.     gpu.fill(10, h-4, 25, 3, " ")
  100.     gpu.setForeground(0x000000)
  101.     mon.setCursor(18, h-3)
  102.     print("Abbrechen")
  103.    
  104.     gpu.setBackground(0xDF0101)
  105.     gpu.fill(125, h-4, 25, 3, " ")
  106.     gpu.setForeground(0x000000)
  107.     mon.setCursor(135, h-3)
  108.     print("Senden")
  109.    
  110.    
  111.    
  112.     gpu.setBackground(0xFFFFFF)
  113.     gpu.fill(10, h-12, w-20, 6, " ")
  114.    
  115.     gpu.setForeground(0x000000)
  116.     mon.setCursor(12, h-10)
  117.     if best == "" then
  118.         print("Geben Sie eine Bestellung ein.")
  119.     elseif name == "" then
  120.         print("Geben Sie einen Namen ein.")
  121.     elseif prio == "" then
  122.         print("Legen Sie eine Priorität fest.")
  123.     end
  124.    
  125.    
  126.     if prio == "hoch" then
  127.         gpu.setBackground(0x0000FF)
  128.         gpu.fill(75, 15, 1, 3, " ")
  129.         gpu.fill(94, 15, 1, 3, " ")
  130.         gpu.setBackground(0xFFFFFF)
  131.         gpu.setForeground(0x000000)
  132.         mon.setCursor(12, h-9)
  133.         print("Priorität auf 'HOCH' festgelegt!         ")
  134.     elseif prio == "mittel" then
  135.         gpu.setBackground(0x0000FF)
  136.         gpu.fill(100, 15, 1, 3, " ")
  137.         gpu.fill(119, 15, 1, 3, " ")
  138.         gpu.setBackground(0xFFFFFF)
  139.         gpu.setForeground(0x000000)
  140.         mon.setCursor(12, h-9)
  141.         print("Priorität auf 'MITTEL' festgelegt!       ")
  142.     elseif prio == "niedrig" then
  143.         gpu.setBackground(0x0000FF)
  144.         gpu.fill(125, 15, 1, 3, " ")
  145.         gpu.fill(144, 15, 1, 3, " ")
  146.         gpu.setBackground(0xFFFFFF)
  147.         gpu.setForeground(0x000000)
  148.         mon.setCursor(12, h-9)
  149.         print("Priorität auf 'NIEDRIG' festgelegt!      ")
  150.     end
  151.    
  152.     local klickb = true
  153.    
  154.     while klickb do
  155.         local _,_,x,y = event.pull("touch")
  156.         if x>24 and x<w-10 and y>8 and y<13 then
  157.             mon.setCursor(12, h-10)
  158.             print("Bestätigen Sie mit 'ENTER' !           ")
  159.             mon.setCursor(26, 10)
  160.             best = io.read()
  161.             bestellung()
  162.         end
  163.         if x>24 and x<56 and y>14 and y<19 then
  164.             mon.setCursor(12, h-10)
  165.             print("Bestätigen Sie mit 'ENTER' !            ")
  166.             mon.setCursor(26, 16)
  167.             name = io.read()
  168.             bestellung()
  169.         end
  170.         if x>74 and x<96 and y>14 and y<19 then
  171.             mon.setCursor(12, h-10)
  172.             print("Priorität auf 'HOCH' festgelegt!        ")
  173.             prio = "hoch"
  174.             gpu.setBackground(0x0000FF)
  175.             gpu.fill(75, 15, 1, 3, " ")
  176.             gpu.fill(94, 15, 1, 3, " ")
  177.             bestellung()
  178.         end
  179.         if x>99 and x<121 and y>14 and y<19 then
  180.             mon.setCursor(12, h-10)
  181.             print("Priorität auf 'MITTEL' festgelegt!       ")
  182.             prio = "mittel"
  183.             gpu.setBackground(0x0000FF)
  184.             gpu.fill(100, 15, 1, 3, " ")
  185.             gpu.fill(119, 15, 1, 3, " ")
  186.             bestellung()
  187.         end
  188.         if x>124 and x<146 and y>14 and y<19 then
  189.             mon.setCursor(12, h-10)
  190.             print("Priorität auf 'NIEDRIG' festgelegt!      ")
  191.             prio = "niedrig"
  192.             gpu.setBackground(0x0000FF)
  193.             gpu.fill(125, 15, 1, 3, " ")
  194.             gpu.fill(144, 15, 1, 3, " ")
  195.             bestellung()
  196.         end
  197.         if x>9 and x<36 and y>h-5 and y<h-1 then
  198.             klickb = false
  199.             startseite()
  200.         end
  201.     end
  202. end
  203.  
  204.  
  205. startseite()
  206.  
Advertisement
Add Comment
Please, Sign In to add comment