Advertisement
osmarks

yet another spatial IO thing somehow?

Dec 25th, 2020 (edited)
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local chatbox = peripheral.find "chat_box"
  2. local prefix = os.getComputerLabel():lower()
  3. chatbox.setName(prefix)
  4. local spatial
  5. for _, n in pairs(peripheral.getNames()) do
  6.     if peripheral.getType(n) == "appliedenergistics2:spatial_io_port" then
  7.         spatial = n
  8.     end
  9. end
  10.  
  11. while true do
  12.     local _, _, player, msg = os.pullEvent "chat_message"
  13.     if player == "gollark" or player == "heav_" or player == "ubq323" then
  14.         if msg:lower():match("^" .. prefix:gsub("%-", "%%-")) then
  15.             rs.setOutput(spatial, true)
  16.             sleep(0.2)
  17.             rs.setOutput(spatial, false)
  18.             chatbox.say "Done!"
  19.         end
  20.         if msg == "!!RESTART" then
  21.             chatbox.say "Doing so."
  22.             sleep(math.random(0, 10))
  23.             chatbox.say "Delay over."
  24.             os.reboot()
  25.         end
  26.         if msg == "!!PING" then
  27.             chatbox.say "Hi, I exist."
  28.         end
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement