Goonstation Forums
Insert text into an intercom using the mechanics components. - Printable Version

+- Goonstation Forums (https://forum.ss13.co)
+-- Forum: Discussion (https://forum.ss13.co/forumdisplay.php?fid=6)
+--- Forum: General Discussion (https://forum.ss13.co/forumdisplay.php?fid=7)
+--- Thread: Insert text into an intercom using the mechanics components. (/showthread.php?tid=4639)



Insert text into an intercom using the mechanics components. - atomic1fire - 04-23-2015

Is this possible? How would the regex look?

I was tinkering in mechanics trying to figure out if I could send messages to the intercoms by prefixing a string with :in

couldn't figure out how because I have no idea how to regex.

e.g microphone component text >> regex add :in >> speaker component ":in blah blah blah" >> intercom "blah blah blah"


Re: Insert text into an intercom using the mechanics compone - BaneOfGiygas - 04-23-2015

Speaking of regex, someone should really find a guide for it on the internet and link it to the relevant parts of the MechComp tutorial.


Re: Insert text into an intercom using the mechanics compone - Erev - 04-24-2015

I just tried a simple setup using a button and a sound synth. Not only does :in MESSAGE not work, but neither does turning on the intercomm's microphone manually and then using the sound synth to play a normal HONK!!! It is probably set up that way to prevent spamming but it would be nice to be able to interface with the intercomms.


Re: Insert text into an intercom using the mechanics compone - Telegnats - 04-24-2015

BaneOfGiygas Wrote:Speaking of regex, someone should really find a guide for it on the internet and link it to the relevant parts of the MechComp tutorial.

Most Regex's operate in vaugely the same way, so any regex tutorial should help out at least somewhat. I found the one on RegexOne to be particularly helpful when I had to learn it for a class. I figure I could type up a small tutorial for it given a few days.


Re: Insert text into an intercom using the mechanics compone - Vitatroll - 04-24-2015

With regards to regex, it's not really that useful to know more than the basics. I only tend to use things like:

Any digit: \d
Any letter: \w
Any single char: .
Character escape: \
Any three digits: \d{3}
Any amount of digits: \d*
Three to nine letters: \w{3,9}
Three or more of any letter: \w{3,}
The case-sensitive word "fArTe": fArTe
The case-insensitive word "FaRtE": [Ff][Aa][Rr][Tt][Ee]
Only the case-sensitive words "fArTe" and "FaRtE": fArTe|FaRtE
A letter in the range from a to f, and a number in the range from 7 to 9: [a-f][7-9]
NOT a letter in the range from a to f, and a number in the range from 7 to 9: [^a-f][^7-9]

I really don't use more than these. For instance: /.*[Ff][Aa][Rr][Tt][Ee]-\d{3}.*/ will match and return any sequence of any characters that include the pattern of a case-insensitive word farte, a dash, and any 3 digits. Say, afs45ak-3SAsjffartE-420, would return but, fasdj hfksf FARTE-4200 asbut, wouldn't.


Re: Insert text into an intercom using the mechanics compone - Marquesas - 04-24-2015

The case insensitive word '[Ff][Aa][Rr][Tt][Ee]': /farte/i


Re: Insert text into an intercom using the mechanics compone - Vitatroll - 04-24-2015

Marquesas Wrote:The case insensitive word '[Ff][Aa][Rr][Tt][Ee]': /farte/i
Hmm. I'm pretty sure I tried that flag. I'mma hop on and test it again.

Yeah. /farte/i doesn't work for me. Interestingly enough, /[f][a][r][t][e]/i does.


Re: Insert text into an intercom using the mechanics compone - Marquesas - 04-25-2015

I might have this forwarded to Lummox (he wrote the regex lib) cause that is just plain Dumb.


Re: Insert text into an intercom using the mechanics compone - Dabir - 04-25-2015

Good luck with that, it hasn't been updated in years.


Re: Insert text into an intercom using the mechanics compone - Marquesas - 04-25-2015

Wrong, Wire recently got Lummox to take a look at one of the bugs he ran into.


Re: Insert text into an intercom using the mechanics compone - Wire - 04-27-2015

Fixed it too! I was proud of that one.