Advertisement
Guest User

startup

a guest
Jul 28th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3. print("==========================================")
  4. print("           Skynet Defense Systems         ")
  5. print("==========================================")
  6. rednet.open("back")
  7. -----------------------------SiloFunction----------------------------
  8. allSilos = {}
  9.  
  10. function getSilos()
  11.     allSilos = {}
  12.     rednet.broadcast("CheckIn")
  13.     checking = true
  14.     while checking do
  15.         x = nil
  16.         y = nil
  17.         x,y = rednet.receive(2)
  18.         if x ~= nil and y ~= nil then
  19.             table.insert(allSilos, y)
  20.         else
  21.             checking = false
  22.         end
  23.     end
  24. end
  25. ---------------------To get the active silos ID's---------------------
  26. while true do
  27.     print("==========================================")
  28.     print("            Launch Interface              ")
  29.     print("==========================================")
  30.     print("[1] ListSilos")
  31.     print("[2] Launch")
  32.     input = read()
  33.     if input == "1" then
  34.         getSilos()
  35.         term.setCursorPos(1,20)
  36.         print("List of available silos:")
  37.         for _,ID in pairs(allSilos) do
  38.             print("Silo #"..ID.." ready for launch.")
  39.         end
  40. ---------------------------Launch Control-----------------------------
  41.         elseif input == "2" then
  42.         print("Enter # of launches.")
  43.         local launches = read()
  44.         print("Location Tracking...")
  45.         print("X:")
  46.         tonumber(read())
  47.         print("Y:")
  48.         tonumber(read())
  49.         print("Z:")
  50.         tonumber(read())
  51.  
  52.         local lauchCoords = textutils.serialize({x=x, y=y, z=z})
  53.         for i=1,tonumber(launches) do
  54.             for _,silo in pairs(allSilos) do
  55.                 rednet.send(tonumber(silo),launchCoords)
  56.                 sleep(4)
  57.             end
  58.         end
  59.     end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement