mIRC Home    About    Download    Register    News    Help

Print Thread
#257237 24/03/16 06:16 AM
Joined: Mar 2016
Posts: 3
Self-satisified door
OP Offline
Self-satisified door
Joined: Mar 2016
Posts: 3
Hey Guys,

I am pretty new to mIRC. I have a small, self taught background in HTML/CSS, but I am now trying to learn mIRC to have the coolest Twitch bot ever.

Anyway, I have a script that replies in a cheeky way when someone uses the wrong grammar with your/you're.

WHAT I WANT:
I want the response to happen when anyone says something like "your a star!"

THE PROBLEM:
It is responding to people even when they say something like "your arsenal" because "your a" is in that sentence. I tried adding a space to it, so it knows that it has to be the word "a" and not just anything with 'a' in it, but I can't figure it out.

Obviously I can't use "on *:TEXT: Your a:* " because that would have to be ALL they type, but "on *:text:*your a*:#:" isn't working either.

I know this is basic, and probably already answered somewhere, but I didn't know what to search.

Thanks,
Tara

Joined: Sep 2014
Posts: 52
Babel fish
Offline
Babel fish
Joined: Sep 2014
Posts: 52
Try using a regular expression. You can get help with, and test your own regular expressions using a site like http://www.regexr.com/

Code:
on $*:text:/your\s(a|an)\s/i:#: {
  msg # success!
}

Joined: Mar 2016
Posts: 3
Self-satisified door
OP Offline
Self-satisified door
Joined: Mar 2016
Posts: 3
Thanks. I am really confused about what all of the */# stuff even means in this language, and it seems that site kinda helps with it.

Is there a good place to start when trying to learn what they all mean? I've been searching, and everything seems to be above my skill-level. frown

I can't even get the copy/pasted code for link timing out or caps timing out to work, and I suspect it's because you need to know enough to know which variables to change so it works with your specific channel. I also can't figure out how to actually write a reglist (the commands I've found don't work when pasted.)

I dunno, I am very lost. Pretty much all I can get to work, even when looking up guides or using codes on this forum is things like this:

on *:TEXT: !playlist:* { msg $chan Tara's Spotify Playlist: http://open.spotify.com/user/tarababcockdotcom/playlist/4MFbag5H1qlO0kSoCvSHYh }

It's frustrating!


Tara Babcock (mIRC Noob)
www.twitch.tv/tarababcock
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Regex is really confusing until you've played around with it for a while, but it's very useful once you understand it. The good thing about regex is it's basically the same for all programming languages, so you only need to learn it once.


I can try and explain paper0rplastic's code:



$ indicates the text event is based on a regular expression (regex)

The * that comes after shows the access level, and here * means all users can trigger the event. In mIRC # means channel (same as $chan). There's no channel name specified, so this will work in any channel

/your\s(a|an)\s/i this is the regex. and the /'s show the beginning and end of the regex.

\s this is what's called a metacharacter. The \ is used to escape characters, so the next character is not a literal "s". Instead \s translates to a space

(a|an) either "a" or "an" will meet this requirement

\s another space

/i the / is the end of the regex, and the "i" is called a flag. It means the regex is case-insensitive


So, effectively this regex will trigger on things like

"YOUR AN..."
"YoUR a somethignsomething"
"your an blabal"


Link Copied to Clipboard