Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Insert text into an intercom using the mechanics components.
#1
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"
Reply
#2
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.
Reply
#3
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.
Reply
#4
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.
Reply
#5
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.
Reply
#6
The case insensitive word '[Ff][Aa][Rr][Tt][Ee]': /farte/i
Reply
#7
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.
Reply
#8
I might have this forwarded to Lummox (he wrote the regex lib) cause that is just plain Dumb.
Reply
#9
Good luck with that, it hasn't been updated in years.
Reply
#10
Wrong, Wire recently got Lummox to take a look at one of the bugs he ran into.
Reply
#11
Fixed it too! I was proud of that one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)