Advertisement
Birog

Kuh-Farm

Mar 9th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.89 KB | None | 0 0
  1. rednet.open("top")
  2. while true do
  3.     term.clear()
  4.     term.setCursorPos(1,1)
  5.     print("Das ist die automatische Kuhfarm von TheBommel")
  6.     print("----------------------------------------------")
  7.     print("Was soll gesteuert werden?")
  8.     print("1: Bodenplatte oeffnen oder schliessen")
  9.     print("2: Feed-Station ein- oder ausschalten")
  10.     print("Bitte waehle zwischen 1 und 2")
  11.     oc = read()
  12.    
  13.     if oc == "1" then
  14.       term.clear()
  15.       term.setCursorPos(1,1)
  16.       print("Bodenplatte ein- oder ausfahren?")
  17.       print("Einfahren = 1")
  18.       print("Ausfahren = 2")
  19.       print("Ausfahren und danach")
  20.       print("wieder automatisch einfahren = 3")
  21.       signal = read()
  22.         if signal == "1" then
  23.          rednet.send(177, "ein")
  24.          print("Wurde ausgeführt!")
  25.          local id,msg,dist = rednet.receive()
  26.            if msg == "fertig" then
  27.             print("fertig")
  28.           end
  29.         elseif signal == "2" then
  30.          rednet.send(177, "aus")
  31.          local id,msg,dist = rednet.receive()
  32.            if msg == "fertig" then
  33.             print("fertig")
  34.            end
  35.          print("Wurde ausgeführt!")
  36.         elseif signal == "3" then
  37.          rednet.send(177, "auto")
  38.          print("Wurde ausgeführt!")
  39.           local id,msg,dist = rednet.receive()
  40.           if msg == "fertig" then
  41.            print("fertig")
  42.           end
  43.         else
  44.          print("Falsche Eingabe!")
  45.         end
  46.     elseif oc == "2" then
  47.       term.clear()
  48.       term.setCursorPos(1,1)
  49.       print("Feed-Station ein- oder ausschalten?")
  50.       print("Einschalten = 1")
  51.       print("Ausschalten = 2")
  52.       signal = read()
  53.         if signal == "1" then
  54.          rednet.send(176, "ein")
  55.          print("Wurde ausgeführt!")
  56.          local id,msg,dist = rednet.receive()
  57.           if msg == "fertig" then
  58.             print("fertig")
  59.           end
  60.         elseif signal == "2" then
  61.          rednet.send(176, "aus")
  62.          print("Wurde ausgeführt!")
  63.          local id,msg,dist = rednet.receive()
  64.           if msg == "fertig" then
  65.             print("fertig")
  66.           end
  67.         else
  68.          print("Falsche Eingabe!")
  69.         end
  70.     else
  71.         print("Falsche Eingabe!")
  72.     end
  73. sleep(1)
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement