Hotlink reverse modes

By Ken on Feb 25, 2008

Well, I decided to try something new with mirc, and that was hotlinks. Just tried them out and they are kind of neat. Anyway, this snippet will reverse a mode previously set by double-clicking on the mode event.

If you'd like to add or remove modes, change the letters in [ohvbeIsklim].

Updates: Now handles multiple modes at a time! - Thanks EL

;----------------------------------
; Reverse modes
; - Written and tested in 6.31
; - Developed by Ken
;----------------------------------
; In a mode event, hover over the '+o/+h' token.
; Double-click, and it will reverse the mode.
; Add or remove modes by changing the letters in '[ohvbeIsklim]'
;----------------------------------

on $^*:hotlink:/[+-][ohvbeIsklim]/:#:{
  if ($nick(#,$me,@%)) return
  else halt
}

on $*:hotlink:/[+-][ohvbeIsklim]/:#:{
  var %a $hotline, %b $findtok(%a,$wildtok(%a,$+(*,$iif(+ isin %a,$v1,-),*),1,32),32), %c $gettok(%a,$+($calc(%b +1),-),32)
  mode # $+($iif(+ isin %a,-,+),$right($gettok(%a,%b,32),-1)) %c
}

Comments

Sign in to comment.
Ken   -  Feb 27, 2008

Alright.
The regex itself is doing the match, and if the regex matches, there must be a matching string or word. And the backreferance will just put that into the memory so you can read it later on.

Here\'s my version:

on $^*:hotlink:/[+-][ohvbeIsklim]/:#: scon -r $iif($nick(#,$me,@%),return,halt)
on $*:hotlink:/([+-][ohvbeIsklim])/:#: mode # $replacex($regml(1),+,-,-,+)

I see how you approached it, I didn\'t realize you could use parenthesis that way, nice code. :D However, I don\'t understand how it would set user modes because you would also need to match the target. That would work for channel modes, but not user modes. Unless I am missing something. :o

Thanks guys for the positive feedback!

 Respond  
Korvin   -  Feb 27, 2008

great idea =D

 Respond  
Lindrian   -  Feb 27, 2008

Alright.
The regex itself is doing the match, and if the regex matches, there must be a matching string or word. And the backreferance will just put that into the memory so you can read it later on.

Here\'s my version:

on $^*:hotlink:/[+-][ohvbeIsklim]/:#: scon -r $iif($nick(#,$me,@%),return,halt)
on $*:hotlink:/([+-][ohvbeIsklim])/:#: mode # $replacex($regml(1),+,-,-,+)
 Respond  
SnoooP   -  Feb 27, 2008

nice works very well thanks!

 Respond  
EL   -  Feb 26, 2008

Nice update Ken.Works even better now ty.`-.-

 Respond  
Ken   -  Feb 26, 2008

if you made that regex, you should know how to create a back referance, and how to use it. Of course I created that regex, I can\'t imagine something as simple as the regex I use is extremely hard to create. I\'m not a leecher. :/

The purpose of that regex is to just match the modes, I myself am not that skilled in regex, and as stated above, the regex I made is very simple. However, I don\'t understand how you could use a back reference in this case, as I primarily use tokens to locate the position of the mode in the string. Normally, without any themes, an mIRC user should have mIRC\'s default event text (<NICK1 sets mode: ). This one uses %b to find and %c to find , I don\'t understand how back referencing could achieve that, unless I added or something to the regex.

If you could show me how it would be done, that\'d be great. I\'m not particularly great at regex. :(

 Respond  
Lindrian   -  Feb 26, 2008

Just use back referances from your regex instead of using a bunch of tokens... if you made that regex, you should know how to create a back referance, and how to use it.

 Respond  
ZiX   -  Feb 26, 2008

very nice snippet

 Respond  
Ken   -  Feb 26, 2008

Updated! Now can handle multiple modes at a time, thanks EL for the idea. :) I\'ve been receiving positive feedback so far, hope that continues.

Keep postin\' comments guys. :P

 Respond  
napa182   -  Feb 26, 2008

Nice.. i like this..I never got around to trying out the on hotlink yet...

 Respond  
EL   -  Feb 25, 2008

Hey thats bad ass lol.Cool idea i had to change it for chatspace but ther then that it works.Not sure if its possable but when you more then one mode change +spl as suck you can only -l and not s(secret) p(private) it only reverses the last one set.But one at a time +s +p +l if you double click on each it will reverse them all.Interesting idea i like it.Good work.\"Rate ir or Hate it?\"...8/10.`-.-

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.