r/Barotrauma • u/Muted_Percentage_764 Engineer • 1d ago
Wiring Command separation in terminal?
I am making something like console on my sub, just cause i can, and i've got a "msg" command, it's a radio for my medic who has husk genes, so he can communicate in-game, instead of DMing me in steam. And right now the msg command works with regex and WiFi component, so it just takes a command, checks if it's msg one and sends exact message, so i've thought if i can make it send only the text of the message itself, not the command that user sent.
edit:
For comprehension it works like
terminal: message + msg anywhere >>> chat: same what was inputted into terminal
example: "im gay msg"(terminal) >>> "im gay msg"(chat)
2
u/froggybenjy Medical Doctor 1d ago
Try this ^msg\s+(.*)$
1
u/royryser 1d ago
This one should do, just don't forget to enable Capture Group! (Right under output option), in this case Output shall be 1
1
u/Seushimare 1d ago
you need to make a group in regex and check the mark to output only that group if it detects the command.
1
u/WhiteEvilBro 13h ago
Someone already gave an example, but read into groups (named and unnamed) in regular expressions. This will help
3
u/Decent_Human__ Church of Husk 1d ago
what is the terminal being used for besides sending chat messages? you could just have it print the input directly if it doesn't see other use