mIRC Home    About    Download    Register    News    Help

Print Thread
#243922 11/01/14 11:55 AM
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
I am trying to make a script that will trigger an event when someone types an email and then return that email.

What I have is:

on $*:text:*@*.*:#channel: {
.timer 1 2 say Your email is $1
}

But obviously this only works if the email is the first word of the line. Is there a way to return just the trigger word?

Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Hello

Do you mean something like this:

Code:
ON *:TEXT:*@*:#: {
  .msg $chan your email address is $1
}


Then if myemail@somewhere.com is entered it says in the room your email is myemail@somewhere.com

The above code will be triggered by anyone using it and will be triggered if @ is used. so if only @ is typed it will only return @



Regards

JayStew
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
That is what I want, but I need it to match if the email is in a sentence as well... so I need it to match:

test@test.com

My email is test@test.com.

Email me at test@test.com for support.

etc




I may be way off base, but I tried using something like this...

on $*:text:*@*.*:#channel: {
if (*@* isin $1) {.timer 1 4 say Your email is $1}
if (*@* isin $2) {.timer 1 4 say Your email is $2}
if (*@* isin $3) {.timer 1 4 say Your email is $3}
if (*@* isin $4) {.timer 1 4 say Your email is $4}
if (*@* isin $5) {.timer 1 4 say Your email is $5}
}


But it doesn't match when I test it.

Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55

Do you mean something like this below.

Code:
ON *:TEXT:*:#:{
  set %1 @
  set %2 .
  if ( %1 isin $1- ) && ( %2 isin $1- ) {
     .msg $chan Your email is $1-
  }
}


Regards

JayStew
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Originally Posted By: jaystew

Do you mean something like this below.

Code:
ON *:TEXT:*:#:{
  set %1 @
  set %2 .
  if ( %1 isin $1- ) && ( %2 isin $1- ) {
     .msg $chan Your email is $1-
  }
}


When someone says 'My email is test@testing.com' that returns 'Your email is My email is test@testing.com'

lol that is all i have been able to do

Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Ahh I see what you mean, you want it to return the email address only not the full sentence.

tricky, will have to think about this one and research lol


Regards

JayStew
Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Originally Posted By: jaystew
Ahh I see what you mean, you want it to return the email address only not the full sentence.

tricky, will have to think about this one and research lol


Yes, it doesn't seem like it should be so hard lol

Joined: Jan 2004
Posts: 1,361
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,361
Code:
on $*:text:*:#:{
  if ($regex($1-,/\b([a-z0-9._+-]+@(?:[a-z0-9-]+\.)+[a-z]+)\b/iS)) {
    msg # $regml(1)
  }
}

Joined: Jan 2014
Posts: 15
J
Pikka bird
OP Offline
Pikka bird
J
Joined: Jan 2014
Posts: 15
Originally Posted By: Loki12583
Code:
on $*:text:*:#:{
  if ($regex($1-,/\b([a-z0-9._+-]+@(?:[a-z0-9-]+\.)+[a-z]+)\b/iS)) {
    msg # $regml(1)
  }
}


THANK YOU!

Joined: Jul 2006
Posts: 4,211
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,211
A regex matchtext on * and then $regex grin ?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jan 2004
Posts: 1,361
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,361
Originally Posted By: Wims
A regex matchtext on * and then $regex grin ?

I had to take the regex out of the matchtext because of the ":", but neglected to take out the $.

Correction:
Code:
on *:text:*:#:{
  if ($regex($1-,/\b([a-z0-9._+-]+@(?:[a-z0-9-]+\.)+[a-z]+)\b/iS)) {
    msg # $regml(1)
  }
}


Link Copied to Clipboard