campicus, on 19 October 2013 - 08:54 PM, said:
Hey everyone! I am using the chatbox peripheral, which is awesome. What I have is this:
[code="lua"]
chat = peripheral.wrap("front")
while true do
e, player, msg = os.pullEvent("chat")
if player == "campicus" and msg == "/o" then
for x = 1,2 do
rs.setOutput("back", true)
sleep(0.5)
rs.setOutput("back", false)
sleep(0.5)
end
end
end
[/code]
The chatbox doesnt pick this up, is there any way I can get it to pull something like this?
there is a little bit of confusion where it comes to OpenPeripherals, "chatbox_command" has nothing to do with the actual chatbox
instead i would use, chat_command where the command is fired by a $$ not a /
here:
chat = peripheral.wrap("front")
while true do
e, msg = os.pullEvent()
if e=="chat_command" and msg=="c" then -- where chat_command event is fired by $$ in chat, the beauty of this is, noone sees your commands :)/>
for x = 1,2 do
rs.setOutput("back", true)
sleep(0.5)
rs.setOutput("back", false)
sleep(0.5)
end
end
end