testChat.lua

Download Raw Clone


  1. chat = peripheral.wrap("chatBox_0")
  2. screen = peripheral.wrap("monitor_0")
  3. speaker = peripheral.wrap("speaker_2")
  4. waitTime = 20 -- seconds
  5. lastFriday = 0
  6. while true do
  7. event = {os.pullEvent()}
  8. if event[1] == "chat" and event[3] == "Friday" then
  9. lastFriday = os.clock()
  10. elseif event[1] == "chat" and os.clock() - lastFriday <= waitTime then
  11. speaker.speak(event[3])
  12. -- parse(event[2], event[3])
  13. end
  14. end

Raw paste data: