This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
campicus's profile picture

Chatbox Pulling From A /msg

Started by campicus, 19 October 2013 - 07:54 PM
campicus #1
Posted 19 October 2013 - 09:54 PM
Hey everyone! I am using the chatbox peripheral, which is awesome. What I have is this:


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

The chatbox doesnt pick this up, is there any way I can get it to pull something like this?
CreeperGoBoom #2
Posted 19 October 2013 - 11:47 PM
Hey everyone! I am using the chatbox peripheral, which is awesome. What I have is this:


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

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
theoriginalbit #3
Posted 20 October 2013 - 01:43 AM
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 /
No. If you're going to help, have a little more knowledge in peripherals. The OP could be using MiscPeripherals which adds a chat box, which fires the event "chat" as the OP is using, also OpenPeripheral doesn't have a command "chatbox_command" it is "chat_command".


@OP no, the chat box doesn't intercept commands, only player chat and death messages, so if you prefix with '/' the message will go to the server and the chatbox will not pick it up. If you wish to send messages to your computer without anyone seeing (except IRC) use OpenPeripheral terminal glasses, as CreeperGoBoom stated they use $$ in the front, and they do not display in the chat.
campicus #4
Posted 20 October 2013 - 02:26 AM
Thanks for the advice guys!
campicus #5
Posted 20 October 2013 - 08:47 PM
Apparently (and I have not tested this) you can just put "/" in front of whatever you write and the chatbox (but not the ingame chat) will pick it up?
This does not work :(/>
campicus #6
Posted 21 October 2013 - 08:14 PM
I am playing on mindcrack, so no peripheral glasses? :(/> I can't find a way to do what I want and I look like a douche saying "open" and "close" in chat all the time haha
Inumel #7
Posted 22 October 2013 - 06:33 PM
You could always switch to a player detector, Granted its not voice activated and you have to have the block showing but.. It stops the aforementioned douchieness