drProfessorGTA

DrohneFernV1

Aug 25th, 2020 (edited)
1,445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.68 KB | None | 0 0
  1. rednet.open("back")
  2. print("Fernsteuerung gestartet...")
  3. os.sleep(1.5)
  4. bewegung="Ebene"
  5. arbeit="Abbau"
  6.  
  7. write("Geben Sie die ID der Drohne ein: ")
  8. id = io.read()
  9. id=id+0
  10.  
  11. shell.run("clear")
  12. print("Aktuelle Einstellungen:")
  13. write("Bewegungsmodus: ")
  14. print(bewegung)
  15. write("Arbeitsmodus: ")
  16. print(arbeit)
  17. while true do
  18. local event, key = os.pullEvent( "key" )
  19.  
  20.     schalter=0
  21.    
  22.     if schalter==0 and bewegung=="Ebene" and key == keys.numPadAdd then
  23.         bewegung="Hohe"
  24.         shell.run("clear")
  25.         print("Aktuelle Einstellungen:")
  26.         write("Bewegungsmodus: ")
  27.         print(bewegung)
  28.         write("Arbeitsmodus: ")
  29.         print(arbeit)
  30.         schalter=1
  31.     end
  32.     if schalter==0 and bewegung=="Hohe" and key == keys.numPadAdd then
  33.         bewegung="Ebene"
  34.         shell.run("clear")
  35.         print("Aktuelle Einstellungen:")
  36.         write("Bewegungsmodus: ")
  37.         print(bewegung)
  38.         write("Arbeitsmodus: ")
  39.         print(arbeit)
  40.         schalter=1
  41.     end
  42.    
  43.    
  44.    
  45.     if schalter==0 and arbeit=="Abbau" and key == keys.numPad6 then
  46.         arbeit="Bau"
  47.         shell.run("clear")
  48.         print("Aktuelle Einstellungen:")
  49.         write("Bewegungsmodus: ")
  50.         print(bewegung)
  51.         write("Arbeitsmodus: ")
  52.         print(arbeit)
  53.         schalter=1
  54.     end
  55.     if schalter==0 and arbeit=="Bau" and key == keys.numPad6 then
  56.         arbeit="Scan"
  57.         shell.run("clear")
  58.         print("Aktuelle Einstellungen:")
  59.         write("Bewegungsmodus: ")
  60.         print(bewegung)
  61.         write("Arbeitsmodus: ")
  62.         print(arbeit)
  63.         schalter=1
  64.     end
  65.     if schalter==0 and arbeit=="Scan" and key == keys.numPad6 then
  66.         arbeit="Abbau"
  67.         shell.run("clear")
  68.         print("Aktuelle Einstellungen:")
  69.         write("Bewegungsmodus: ")
  70.         print(bewegung)
  71.         write("Arbeitsmodus: ")
  72.         print(arbeit)
  73.         schalter=1
  74.     end
  75.    
  76.     if schalter==0 and arbeit=="Abbau" and key == keys.numPad4 then
  77.         arbeit="Scan"
  78.         shell.run("clear")
  79.         print("Aktuelle Einstellungen:")
  80.         write("Bewegungsmodus: ")
  81.         print(bewegung)
  82.         write("Arbeitsmodus: ")
  83.         print(arbeit)
  84.         schalter=1
  85.     end
  86.     if schalter==0 and arbeit=="Scan" and key == keys.numPad4 then
  87.         arbeit="Bau"
  88.         shell.run("clear")
  89.         print("Aktuelle Einstellungen:")
  90.         write("Bewegungsmodus: ")
  91.         print(bewegung)
  92.         write("Arbeitsmodus: ")
  93.         print(arbeit)
  94.         schalter=1
  95.     end
  96.     if schalter==0 and arbeit=="Bau" and key == keys.numPad4 then
  97.         arbeit="Abbau"
  98.         shell.run("clear")
  99.         print("Aktuelle Einstellungen:")
  100.         write("Bewegungsmodus: ")
  101.         print(bewegung)
  102.         write("Arbeitsmodus: ")
  103.         print(arbeit)
  104.         schalter=1
  105.     end
  106.    
  107.    
  108.  
  109.     if bewegung=="Ebene" and key == keys.up then
  110.         rednet.send(id,"vor")
  111.     end
  112.     if bewegung=="Ebene" and key == keys.down then
  113.         rednet.send(id,"back")
  114.     end
  115.     if key == keys.left then
  116.         rednet.send(id,"links")
  117.     end
  118.     if key == keys.right then
  119.         rednet.send(id,"rechts")
  120.     end
  121.     if bewegung=="Hohe" and key == keys.up then
  122.         rednet.send(id,"hoch")
  123.     end
  124.     if bewegung=="Hohe" and key == keys.down then
  125.         rednet.send(id,"runter")
  126.     end
  127.    
  128.    
  129.    
  130.     if arbeit=="Abbau" and key == keys.numPad5 then
  131.         rednet.send(id,"abbau")
  132.     end
  133.     if arbeit=="Abbau" and key == keys.numPad8 then
  134.         rednet.send(id,"abbauUp")
  135.     end
  136.     if arbeit=="Abbau" and key == keys.numPad2 then
  137.         rednet.send(id,"abbauDown")
  138.     end
  139.    
  140.    
  141.    
  142.     if arbeit=="Bau" and key == keys.numPad5 then
  143.         rednet.send(id,"bau")
  144.     end
  145.     if arbeit=="Bau" and key == keys.numPad8 then
  146.         rednet.send(id,"bauUp")
  147.     end
  148.     if arbeit=="Bau" and key == keys.numPad2 then
  149.         rednet.send(id,"bauDown")
  150.     end
  151.    
  152.    
  153.    
  154.     if arbeit=="Scan" and key == keys.numPad5 then
  155.         rednet.send(id,"scan")
  156.         id,msg = rednet.receive()
  157.         print(msg)
  158.         os.sleep(3.0)
  159.         shell.run("clear")
  160.         print("Aktuelle Einstellungen:")
  161.         write("Bewegungsmodus: ")
  162.         print(bewegung)
  163.         write("Arbeitsmodus: ")
  164.         print(arbeit)
  165.     end
  166.     if arbeit=="Scan" and key == keys.numPad8 then
  167.         rednet.send(id,"scanUp")
  168.         id,msg = rednet.receive()
  169.         print(msg)
  170.         os.sleep(3.0)
  171.         shell.run("clear")
  172.         print("Aktuelle Einstellungen:")
  173.         write("Bewegungsmodus: ")
  174.         print(bewegung)
  175.         write("Arbeitsmodus: ")
  176.         print(arbeit)
  177.     end
  178.     if arbeit=="Scan" and key == keys.numPad2 then
  179.         rednet.send(id,"scanDown")
  180.         id,msg = rednet.receive()
  181.         print(msg)
  182.         os.sleep(3.0)
  183.         shell.run("clear")
  184.         print("Aktuelle Einstellungen:")
  185.         write("Bewegungsmodus: ")
  186.         print(bewegung)
  187.         write("Arbeitsmodus: ")
  188.         print(arbeit)
  189.     end
  190.    
  191.    
  192.    
  193.     if key == keys.numPad0 then
  194.         shell.run("clear")
  195.         rednet.send(id,"Inventar")
  196.         id,msg = rednet.receive()
  197.         print(msg)
  198.         id,msg = rednet.receive()
  199.         write("Menge: ")
  200.         print(msg)
  201.         os.sleep(3.0)
  202.         shell.run("clear")
  203.         print("Aktuelle Einstellungen:")
  204.         write("Bewegungsmodus: ")
  205.         print(bewegung)
  206.         write("Arbeitsmodus: ")
  207.         print(arbeit)
  208.     end
  209.    
  210.    
  211.    
  212.     if key == keys.numPadDivide then
  213.         os.sleep(0.1)
  214.         shell.run("clear")
  215.         write("Geben Sie eine Nummer ein (1-16): ")
  216.         number = io.read()
  217.         number=number+0
  218.         wahl=0
  219.         if number==1 then
  220.             rednet.send(id,"slot1")
  221.             wahl=1
  222.         end
  223.         if number==2 then
  224.             rednet.send(id,"slot2")
  225.             wahl=1
  226.         end
  227.         if number==3 then
  228.             rednet.send(id,"slot3")
  229.             wahl=1
  230.         end
  231.         if number==4 then
  232.             rednet.send(id,"slot4")
  233.             wahl=1
  234.         end
  235.         if number==5 then
  236.             rednet.send(id,"slot5")
  237.             wahl=1
  238.         end
  239.         if number==6 then
  240.             rednet.send(id,"slot6")
  241.             wahl=1
  242.         end
  243.         if number==7 then
  244.             rednet.send(id,"slot7")
  245.             wahl=1
  246.         end
  247.         if number==8 then
  248.             rednet.send(id,"slot8")
  249.             wahl=1
  250.         end
  251.         if number==9 then
  252.             rednet.send(id,"slot9")
  253.             wahl=1
  254.         end
  255.         if number==10 then
  256.             rednet.send(id,"slot10")
  257.             wahl=1
  258.         end
  259.         if number==11 then
  260.             rednet.send(id,"slot11")
  261.             wahl=1
  262.         end
  263.         if number==12 then
  264.             rednet.send(id,"slot12")
  265.             wahl=1
  266.         end
  267.         if number==13 then
  268.             rednet.send(id,"slot13")
  269.             wahl=1
  270.         end
  271.         if number==14 then
  272.             rednet.send(id,"slot14")
  273.             wahl=1
  274.         end
  275.         if number==15 then
  276.             rednet.send(id,"slot15")
  277.             wahl=1
  278.         end
  279.         if number==16 then
  280.             rednet.send(id,"slot16")
  281.             wahl=1
  282.         end
  283.         os.sleep(0.3)
  284.         if wahl==0 then
  285.             print("Fehlgeschlagen")
  286.         else
  287.             print("Erfolgreich")
  288.         end
  289.         os.sleep(0.7)
  290.         shell.run("clear")
  291.         print("Aktuelle Einstellungen:")
  292.         write("Bewegungsmodus: ")
  293.         print(bewegung)
  294.         write("Arbeitsmodus: ")
  295.         print(arbeit)
  296.     end
  297.    
  298.    
  299.    
  300.     if key == keys.numPadSubtract then
  301.         rednet.send(id,"tanken")
  302.         id,msg = rednet.receive()
  303.         print(msg)
  304.         os.sleep(3.0)
  305.         shell.run("clear")
  306.         print("Aktuelle Einstellungen:")
  307.         write("Bewegungsmodus: ")
  308.         print(bewegung)
  309.         write("Arbeitsmodus: ")
  310.         print(arbeit)
  311.     end
  312.    
  313.     if key == keys.numPad7 then
  314.         shell.run("clear")
  315.         rednet.send(id,"fuel")
  316.         id,msg = rednet.receive()
  317.         write("Tankfuellstand: ")
  318.         print(msg)
  319.         os.sleep(3.0)
  320.         shell.run("clear")
  321.         print("Aktuelle Einstellungen:")
  322.         write("Bewegungsmodus: ")
  323.         print(bewegung)
  324.         write("Arbeitsmodus: ")
  325.         print(arbeit)
  326.     end
  327. end
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
Advertisement
Add Comment
Please, Sign In to add comment