topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 6, 2024, 8:38 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: mircryption and on text scripts  (Read 10089 times)

thede

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
mircryption and on text scripts
« on: April 16, 2007, 11:31 AM »
hi guys,

Ive a question, or a request, depends on it ;) here it is:
I'm using quite some scripts and some of them are working with "on *:TEXT:*my_nick*:#Chan: " lines and it doesn't work with mircryption, so i wondered if its a bug or a "forgetten feature" ;) as its working fine in fish.
am i doing something wrong?
i don't wanna change to fish, it sucks, i wanna stay with mircryption but i really really need that "feature", so i hope you know a way to get it working

greets -thede

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: mircryption and on text scripts
« Reply #1 on: April 16, 2007, 07:35 PM »
hi thede!
hidden in the help file is this.  it's the way to handle such stuff in mircryption.  you'll find it's more work than fish, which can auto takeover the on :text: stuff since it patches mirc, but it is more flexible:

"Unfortunately, in mirc it is not possible to trigger normal text events on decrypted text, so if you have existing scripts which normally are triggered when the user types something, these scripts will not be able to respond to text that is sent to you encrypted.

So you must make some changes to your scripts to allow them to react to encrypted text.

Mircryption provides a signal facility that will help you design very flexible scripts that can see encrypted and normal text, both incoming and outgoing, and handle it appropriately.

To do this, you will use a mirc SIGNAL.  For more help on mirc signals, see the mirc help file.

The mircryption signal you will write a handler for is called MircryptionSignalAll.

The following code is from the bottom of your mircryption.mrc script, and you would copy and paste this into your own script file and use it as the starting point for your script:

; Here is a sample signal trap for catching text BEFORE it is displayed on screen.

;  you can implement this signal in your other scripts if you want to detect

;  and act on text BEFORE it is displayed.  check $1 for the type of event.

; The most common use of this signal is to issue the /mchalt or /mchaltdef commands, which will BLOCK

;  mircryption (or mircryption and mirc) from displaying the text when you return from the signal!

; DONT add your code to this procedure(!!) because it will be overwritten

;  if you upgrade - instead, make your own script file with this code.

on *:SIGNAL:MircryptionSignalAll: {

; 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.

;  note, this signal is triggered on your OWN text too(!), just detect the case where $1==input.

; $1 = event type (input,text,query,notice,action,join,topic,part,kick,quit,nick,mode)

; $2 = target ($chan)

; $3 = speaker ($nick)

; $4 = is $true if text was encrypted or $false if plaintext

; $5- = decrypted text

 

;uncomment to test this

;/echo TRAPPED MircryptionSignalAll: event: $1 , target: $2 , speaker: $3 , encrypted: $4, firstword = $5, text: $5-

;if ($5 == hidethis) {

;  ; this test hides all lines (incoming, actions, outgoing, everything - which starts with the word hidethis)

;  echo 4 MircryptionSignalAll test, hiding your statement.

;  /mchaltdef

;}

}

 

 

Note that an older signal (MircryptionSignal) is still present in the mircryption.mrc script for backward compatibility, but it is being phased out; MircryptionSignalAll provides all of the functionality of the original MircryptionSignal and adds more features.



SO, to recap, go to the bottom of your mircryption.mrc and copy the MircryptionSignalAll function and paste it in a script of your own, then inside that check for and handle the text and input events you want.

thede

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
Re: mircryption and on text scripts
« Reply #2 on: April 20, 2007, 10:26 AM »
thank you mouser, working like a charme - and yes, next time ill use the help :P

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: mircryption and on text scripts
« Reply #3 on: April 20, 2007, 10:46 AM »
hey, there's no shame in not finding stuff in the mircryption help file, it's too big to find anything.