Advertisement
Guest User

startup.lua

a guest
Dec 29th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. local chat = peripheral.find "chat_box"
  2. local side = "right"
  3. local onoff = false
  4.  
  5. chat.setName "Tesla Thingy"
  6.  
  7. function set()
  8.     redstone.setOutput(side, onoff)
  9. end
  10.  
  11. while true do
  12.     _, _, usr, msg = os.pullEvent "chat_message"
  13.    
  14.     local cmd = string.sub(msg, 2)
  15.    
  16.     print(usr, msg, cmd)
  17.    
  18.     if cmd == "tesla" then
  19.         onoff = not onoff
  20.         chat.say("Acknowledged. RS: " .. tostring(onoff))
  21.         set()
  22.     end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement