Thor_s_Crafter

awDracScreen

Apr 8th, 2016
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.94 KB | None | 0 0
  1. -- Automatische Awakened Draconium Farm --
  2. -- Screen Programm --
  3. -- Draconic Evolution --
  4. -- von Thor_s_Crafter --
  5. -- Version 1.0 --
  6.  
  7. mon = peripheral.find("monitor")
  8.  
  9. function autoUpdate()
  10.     if  fs.exists("startup") then
  11.         shell.run("rm startup")
  12.     end
  13.     local file = fs.open("startup","w")
  14.     file.writeLine("shell.run(\"rm draconium\")")
  15.     file.writeLine("shell.run(\"pastebin get ZYjNXvH5 draconium\")")
  16.     file.writeLine("shell.run(\"draconium\")")
  17.     file.close()
  18. end
  19.  
  20. function checkRednet()
  21.     --Suche Modem
  22.     local pList = peripheral.getNames()
  23.     for i=1,#pList do
  24.         if peripheral.getType(pList[i]) == "modem" then
  25.             rednet.open(pList[i])
  26.             modem = pList[i]
  27.         end
  28.     end
  29.    
  30.     while modem == nil do
  31.         term.clear()
  32.         term.setCursorPos(1,1)
  33.         print("Bitte ein Wireless Modem an eine (beliebige) freie Seite anschliessen!")
  34.        
  35.         --Suche Modem erneut
  36.         local pList = peripheral.getNames()
  37.         for i=1,#pList do
  38.             if peripheral.getType(pList[i]) == "modem" then
  39.                 rednet.open(pList[i])
  40.                 modem = pList[i]
  41.             end
  42.         end
  43.        
  44.         print("Enter druecken...")
  45.         local event,key = os.pullEvent("key")
  46.         while key ~= 28 do
  47.             sleep(0.5)
  48.             event,key = os.pullEvent("key")
  49.         end    
  50.     end
  51.            
  52.     local id,msg,protocol = rednet.receive(10) 
  53.     if msg == "test" and protocol == "draconium" then
  54.         rednet.send(id,msg,protocol)
  55.     end
  56.    
  57.     print("Einrichtung beendet.")  
  58.     term.clear()
  59.     print("Programm laueft...")
  60. end
  61.  
  62. function receiveData()
  63.     id,msg = rednet.receive()
  64.     mon.clear()
  65.     mon.setCursorPos(1,1)
  66.     mon.write("-- Statusdisplay der Turtle --")
  67.     mon.setCursorPos(1,3)
  68.     mon.write("Durchlauf: "..msg[1])
  69.     mon.setCursorPos(1,5)
  70.     mon.write("Status:")
  71.     mon.setCursorPos(1,6)
  72.     mon.write(msg[2])  
  73.     mon.setCursorPos(1,7)
  74.     mon.write(msg[3])
  75.     mon.setCursorPos(1,9)
  76.     mon.write("Bitte Magneten o.รค. ausschalten!")
  77. end
  78.  
  79. autoUpdate()
  80. checkRednet()
  81. while true do
  82.     receiveData()
  83.     if msg[2] == "Fertig" then
  84.         break
  85.     end
  86. end
  87.  
  88. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment