Advertisement
VaMinion

stargate_monitor

Dec 27th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. sg = peripheral.wrap("back")
  2.  
  3. shell.run("clear")
  4.  
  5. while true do
  6.  event, where, value = os.pullEvent()
  7.  
  8. --[[-- This prints every OS event as it comes in.
  9.  print(event, " : ", where, " : ", value)]]
  10.  
  11.  -- This gets the address of an incoming dial in case anyone wants to use it.
  12.  if event == "sgDialIn" then
  13.   remoteAddress = value
  14.  end
  15.  
  16.  -- Print which chevron and where the dial is coming from
  17.  if event == "sgChevronEngaged" then
  18.   shell.run("clear")
  19.   print("Incoming activation from ", remoteAddress, "!")
  20.   print("Chevron ", value, " encoded!")
  21.  end
  22.  
  23.  if event == "sgStargateStateChange" and value == "Closing" then
  24.   shell.run("clear")
  25.   print("Event horizon collapsing!")
  26.  end
  27.  
  28.  if event == "sgStargateStateChange" and value == "Connected" then
  29.    shell.run("clear")
  30.    print("Connection to ", remoteAddress, " is active!")
  31.    sg.openIris()
  32.   end
  33.  
  34.  -- Remote iris controls
  35.  if event == "sgMessageReceived" then
  36.   if value == "open_iris" then
  37.    print("Remote iris opening!")
  38.    sg.openIris()
  39.   elseif value == "close_iris" then
  40.    print("Remote iris closing!")
  41.    sg.closeIris()
  42.   end
  43.  end
  44.  
  45.  -- Close the iris if the gate's not running.
  46.  if event == "sgStargateStateChange" and (value == "Idle" or value == "offline") then
  47.   shell.run("clear")
  48.   print("Wormhole inactive.")
  49.   sg.closeIris()
  50.  end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement