mIRC Home    About    Download    Register    News    Help

Print Thread
#167416 23/12/06 06:55 PM
Joined: Dec 2006
Posts: 3
X
Self-satisified door
OP Offline
Self-satisified door
X
Joined: Dec 2006
Posts: 3
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.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
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

Last edited by genius_at_work; 23/12/06 09:17 PM.
Joined: Dec 2006
Posts: 3
X
Self-satisified door
OP Offline
Self-satisified door
X
Joined: Dec 2006
Posts: 3
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?

Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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
}


* cold edits his posts 24/7
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
I would generally use $iif($target == $me,$nick,$target)


If it ain't broken, don't fix it!
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Why would you use something longer (and slightly slower)?


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Jan 2003
Posts: 1,063
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
because it also picks up and processes =$nick etc, it's more dynamic imho


If it ain't broken, don't fix it!
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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".

Last edited by cold; 08/01/07 11:37 PM.

* cold edits his posts 24/7

Link Copied to Clipboard