mIRC Homepage
Posted By: xrestassuredx message preprocessing? - 23/12/06 06:55 PM
here's what i am trying to accomplish: i want to create an mirc plugin that is able to detect messages with a certain format/prefix and process the message before displaying it.

something like has been done with the blowfish plugin (messages prefixed with "+OK" are decrypted before being displayed); i am not creating an encryption per se but that is the behavior i intend to emulate, with the ability to parse and process input before it is displayed.

the development notes on blowfish mention that this is achievable in scripts through certain hacks but that it is rather messy to implement and maintain that way. so, is there a way to harness the funcitonality from the blowfish patch for a completely different plugin?

i have a lot of experience in other fields of pogramming but i am fairly new to this caliber mirc scripting. any advice, examples, places to look for help, would be great. thanks.
Posted By: genius_at_work Re: message preprocessing? - 23/12/06 09:17 PM
Code:
on ^*:TEXT:+OK *:*:{
;do whatever you need to do here

haltdef
}

-Matches text that is formatted like:
+OK some text goes here

The message after +OK is stored in $2-

-genius_at_work
Posted By: xrestassuredx Re: message preprocessing? - 27/12/06 09:33 PM
well, that does work, but with two major problems. first, how do i retain the information about which user sent the message in the first place? the normal $0- variables only relate to the contents of the message.
also, the channel information seems to be lost; something like:
Code:
on ^*:TEXT:+UX *:*:{
  echo message found: $2-
  haltdef
}

echoes the message to the status window, not to the channel in which the original message was sent.

any suggestions?
Posted By: cold Re: message preprocessing? - 27/12/06 09:37 PM
Is this related to channels only (no private messages)?
The code below should do what you want:

Code:
on ^*:TEXT:+UX *:#:{
  echo # message from $nick $+ : $2-
  haltdef
}


In case you want it to work with private messages as well...:
Code:
on ^*:TEXT:+UX *:*:{
  echo $iif(#,#,$nick) message from $nick $+ : $2-
  haltdef
}
Posted By: Doqnach Re: message preprocessing? - 07/01/07 09:55 AM
I would generally use $iif($target == $me,$nick,$target)
Posted By: qwerty Re: message preprocessing? - 07/01/07 10:45 AM
Why would you use something longer (and slightly slower)?
Posted By: Doqnach Re: message preprocessing? - 08/01/07 11:26 AM
because it also picks up and processes =$nick etc, it's more dynamic imho
Posted By: cold Re: message preprocessing? - 08/01/07 11:27 PM
ON TEXT doesn't trigger on DCC chat messages. Also, if someone sends a message to a target like @#channel (which is meant to be received by #channel operators), your script will try to echo in "@#channel" instead of "#channel".
© mIRC Discussion Forums