mIRC Home    About    Download    Register    News    Help

Topic Options
#232369 - 01/06/11 03:29 AM messages
razor32 Offline
Ameglian cow

Registered: 02/09/08
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

Top
#232370 - 01/06/11 03:45 AM Re: messages [Re: razor32]
FroggieDaFrog Offline
Hoopy frood

Registered: 16/04/10
Posts: 910
Loc: USA
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

Top
#232371 - 01/06/11 04:18 AM Re: messages [Re: FroggieDaFrog]
razor32 Offline
Ameglian cow

Registered: 02/09/08
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


Edited by razor32 (01/06/11 04:30 AM)

Top
#232374 - 01/06/11 10:19 AM Re: messages [Re: razor32]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.

Top
#232376 - 01/06/11 02:09 PM Re: messages [Re: FroggieDaFrog]
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: Seattle
Why would you use regex for someone who doesn't know scripting?

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


Edited by DJ_Sol (01/06/11 02:10 PM)

Top
#232377 - 01/06/11 03:22 PM Re: messages [Re: DJ_Sol]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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

Top
#232380 - 01/06/11 07:03 PM Re: messages [Re: Tomao]
Tomao Offline
Hoopy frood

Registered: 07/07/07
Posts: 1129
Loc: United States
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.

Top
#232387 - 02/06/11 05:03 AM Re: messages [Re: Riamus2]
FroggieDaFrog Offline
Hoopy frood

Registered: 16/04/10
Posts: 910
Loc: USA
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

Top
#232418 - 03/06/11 05:13 PM Re: messages [Re: FroggieDaFrog]
dutch1918 Offline
Ameglian cow

Registered: 14/11/05
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?

Top
#232420 - 03/06/11 06:24 PM Re: messages [Re: dutch1918]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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

Top