mIRC Home    About    Download    Register    News    Help

Print Thread
#232369 01/06/11 02:29 AM
Joined: Sep 2008
Posts: 37
R
razor32 Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2008
Posts: 37
Hi,

i'm looking for a script that echo's a certain message when someone uses !msg whatevermsghere but so it only works in a channel i choose.

Does anyone know where I could find one?

Thanks

razor32 #232370 01/06/11 02:45 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
change "#YOUR-CHANNEL-HERE" to the channel you want
Code:
on $*:TEXT:/^!msg .+$/iS:#YOUR-CHANNEL-HERE:{
  echo -a :: This yo message from $nick :: $2-
}


I am SReject
My Stuff
FroggieDaFrog #232371 01/06/11 03:18 AM
Joined: Sep 2008
Posts: 37
R
razor32 Offline OP
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Sep 2008
Posts: 37
Originally Posted By: FroggieDaFrog
change "#YOUR-CHANNEL-HERE" to the channel you want
Code:
on $*:TEXT:/^!msg .+$/iS:#YOUR-CHANNEL-HERE:{
  echo -a :: This yo message from $nick :: $2-
}

Thanks but what I mean is it sends the message into the channel but without without the message they try to do with !msg :+

Edit: got it to work, thanks for your help

Last edited by razor32; 01/06/11 03:30 AM.
razor32 #232374 01/06/11 09:19 AM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
on $*:TEXT:/^!msg (.+)/iS:#YOUR-CHANNEL-HERE:{
 msg $chan This yo message from $nick :: $regml(1)
 }
You should parenthesize (.+) and then use $regml(1) to refer to what people say. By using $2- , the control codes, be that as color, bold, etc.. won't get stripped.

If $2- is chosen to be used, the /S should have been removed and be made as $strip($2-), but that sorta defeats the purpose of using regex in the first place.

Also, I don't know why the dollar sign has to be used after .+ ; it's not needed.

FroggieDaFrog #232376 01/06/11 01:09 PM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Why would you use regex for someone who doesn't know scripting?

Code:
on *:text:!msg *:#YourChannelName:{
msg # Your message from $nick is $2- .
}

Last edited by DJ_Sol; 01/06/11 01:10 PM.
DJ_Sol #232377 01/06/11 02:22 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
He's making it work regardless of someone typing a command in color or bold or whatever. The alternative (and better way to show a new scripter, imo) is to use $strip(). It does make the script a little longer and may be slightly slower or faster (not noticeably), but it's a lot easier to understand for a new scripter.

Personally, I don't cater very often to people who try to type commands in color/bold/etc, but that's just me. By catering to them, you have fewer people asking why a command doesn't work. My thought has always been that users should learn that commands should always be typed in plain text (no color, bold, etc) rather than requiring scripts to slow themselves down (albeit not by much) just to cater to a few people. If all scripts were to require commands be typed in plain text, then everyone would learn it very quickly and there would be no need to cater to anyone. I know, I know... not a popular opinion. smile


Invision Support
#Invision on irc.irchighway.net
Tomao #232380 01/06/11 06:03 PM
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Once again, when you use the /S modifier in regex, it'll only strip the values filled in $regml()
The only thing that gets stripped is the trigger, not $2-, as per froggie's example.

What DJ_Sol has provided will suffice. I've always though it's a safe bet to include the $strip() or tokenize 32 $strip($1-), saving yourself some trouble if any trigger is rendered unresponsive, while you don't have your mIRC set to strip messages.

Riamus2 #232387 02/06/11 04:03 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Sorry about that. Forgot that not everyone knows regex. For channel commands as such I usually use regex(to allow for more command triggers and to verify parameters for the command), and that habbit carried over into the script I posted above.

IE:
Code:
on $1:TEXT:/^[!.@]somecommand \S+ \S+$/iS:#channel:{
  ;do stuff
}


I am SReject
My Stuff
FroggieDaFrog #232418 03/06/11 04:13 PM
Joined: Nov 2005
Posts: 26
D
Ameglian cow
Offline
Ameglian cow
D
Joined: Nov 2005
Posts: 26
Originally Posted By: FroggieDaFrog
change "#YOUR-CHANNEL-HERE" to the channel you want
Code:
on $*:TEXT:/^!msg .+$/iS:#YOUR-CHANNEL-HERE:{
  echo -a :: This yo message from $nick :: $2-
}


How about the ability to send the message to a email?

dutch1918 #232420 03/06/11 05:24 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You would need to find an email script. Check the various scripting sites and you can probably find one with instructions on how to use it.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard