Modifying Bots and Scripts |
Top Previous Next |
If you have a mirc scripts that is designed to speak announcements into a channel or understand comments made by users, you may want to give your mirc scripts a way of speaking in an encrypted tongue.
You can replace in mirc scripts/bots all occurences of the /msg command with the /emsg command, which will have the exact same effect as msg, except that it encrypts text to the channel (if and when appropriate).
For more advanced scripting, you can use the $mc_encrypt() and $mc_decrypt() functions for this purpose:
$mc_encrypt(channelname, text...) - returns encrypted version of text IF channel is set to encrypt, otherwise plaintext $mc_decrypt(channelname, text...) - returns decrypted version of text IF channel has a key, otherwise plaintext
Note these fixes only works with mirc scripts, not eggdrop scripts running on shells. See below for info on eggdrop encryption.
Starting with Mircryption version 1.08.4, mircryption implements a special signal trigger when incoming text is decrypted, whether through channel text, query text, topic change, etc. You can use trap this signal in your own (or 3rd party) scripts to let them implement their own routines for acting on decrypted text, without having to modify mircryption. Note that signals are new to mirc version 6.0x and are not available for mirc clients prior to this.
;--------------------------------------------------------------------------- ; Here is a sample signal trap for catching text after it has been decrypted ; you can implement this signal in your other scripts if you want to detect ; and act on text after it is decrypted or encrypted. test $1 for the type ; of event. on *:SIGNAL:MircryptionSignal: { ; trigger signal for other scripts that want to handle decrypted text, only trigger for text that was received encrypted or outgoing crypted ; this allows other scripts to be written to trigger on incoming encrypted text, without having to modify mircryption. ; $1 = event type (text,notice,action,join,topic,part,kick,quit,nick,mode) ; $2 = target ($chan) ; $3 = speaker ($nick) ; $4- = decrypted text
;uncomment to test this ;/echo TRAPPED MIRCRYPTION SIGNAL: event: $1 , target: $2 , speaker: $3 , text: $4- } ;---------------------------------------------------------------------------
You can also check if the mircryption script is running from your script by checking "if $gotmircryption == $true", which is provided by the following alias in mircryption.mrc: alias gotmircryption { return $true }
|