Computercraft Chat to Speech script

Little script to pull server chat messages and speak them using misc.preipherals speaker and chatbox
Chatbox on left, Speaker on right

--TODO: Compile a table of all networked speakers to cycle through to allow sound reproduction over a larger area
--TODO: Signed server chat to command execution

local chatMsg = ""
local chatBox = peripheral.wrap("left")
local speaker = peripheral.wrap("right")

function getChat()
eventTyp, chatPlr, chatMsg = os.pullEvent("chat")
end

function sayChat()
speaker.speak(chatMsg,0)
end

--Main loop
while true do
getChat()
sayChat()
end

No comments:

Post a Comment