mIRC Homepage

messages

Posted By: razor32

messages - 01/06/11 02:29 AM

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
Posted By: FroggieDaFrog

Re: messages - 01/06/11 02:45 AM

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-
}
Posted By: razor32

Re: messages - 01/06/11 03:18 AM

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
Posted By: Tomao

Re: messages - 01/06/11 09:19 AM

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.
Posted By: DJ_Sol

Re: messages - 01/06/11 01:09 PM

Why would you use regex for someone who doesn't know scripting?

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

Re: messages - 01/06/11 02:22 PM

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
Posted By: Tomao

Re: messages - 01/06/11 06:03 PM

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.
Posted By: FroggieDaFrog

Re: messages - 02/06/11 04:03 AM

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
}
Posted By: dutch1918

Re: messages - 03/06/11 04:13 PM

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?
Posted By: Riamus2

Re: messages - 03/06/11 05:24 PM

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.
© 2021 mIRC Discussion Forums