mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 2,127
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Reposting separately since it wasn't addresses in the other thread when posted above your reply here https://forums.mirc.com/ubbthreads.php/topics/262113/Re:_$hotlink(match)#Post262113

$hotlink(match) behaves differently depending on which direction the mouse cursor is moving when it encounters the hotlink match. It doesn't find a nick in channel by reduce strings starting/ending with non-alphanumeric characters if it arrives from a direction where characters were removed.

Paste the code below in a remote script and run: /hotlinktest

This code uses the 1st nick of the 1st channel, but you can edit the 1st 2 lines to work with any channel/nick combo you wish, and the result is the same. It works best if you arrange your status window so you can see activity at the same time as your mouse is hovering over text within the channel window. The test lines have all 4 combos of the nick with/without non-alphanumerics touching it from left/right/both sides. I didn't obverve where it made a difference which non-alphanumeric was stripped.

$hotlink(match) reduces NICK_ to NICK if NICK_ is not also a nick in channel, but only if you approach it from the top/bottom or from the left-side where the Underscore was not stripped. If you approach it from the right where the Underscore was stripped off, $hotlink(match) is instead filled with the entire not-a-nick word.

Same thing happens if you approach _NICK from the left side where a non-alpanumeric was stripped.

If your mouse approaches -NICK- or +NICK+ or _NICK_ or =NICK= etc from either the left or the right side, $hotlink(match) doesn't find NICK within the string as it does when approaching it from the top/bottom, so it returns the entire string the same as $hotlink(word).

Code:
on *:hotlink:*:*:{
  if ($hotlink(match) != $hotlink(word)) echo 4 -sg $v1 $v2
  else echo 3 -sg $v1 $v2
  ; Note: without HALT, clicking on nick in chat message doesn't change $snick
  ; halt
}
alias hotlinktest {
  var %n $nick($chan(1),1)
  window -a $chan(1)
  var %i 255
  while (%i isnum 0-255) {
    if ($chr(%i) !isalnum) {
      echo -ag line spacer
      echo -ag %i $chr(%i) test %n test %n $+ $chr(%i) test $chr(%i) $+ %n test $chr(%i) $+ %n $+ $chr(%i) test
    }
    dec %i
  }
}


Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks for your bug report. The reason for this quirk is that the hotlink feature works in two ways: the first is the built-in hotlink feature, the second is the HOTLINK event.

The built-in hotlink feature can pick out and match nicknames on channels even if they are surrounded by non-alphanumeric characters. When you move the mouse over them, the hotlink will only appear when over the nickname part of the word.

The HOTLINK event, on the other hand, is designed to pick out words. Since the HOTLINK event does not have an option that says "only hotlink on nicknames", it just reports words. With the recent update to HOTLINK, I extended it to store nicknames in $hotlink(match) if it finds them inside the current word, but even when it does this, its primary purpose is to pick out words for scripts to use and everything in the code is designed around this.

When in the HOTLINK event, moving the mouse over "nickname)" from left to right will make the mouse a hotlink cursor because it is on a word but it will still try to find a nickname inside it and will trim ")" if necessary and will store it in $hotlink(match). However, notice that the moment you move your mouse over the ")" part, it reports the whole word as match. The same applies from right to left.

So the question is, can $hotlink(match) be made to report "nickname", along with the correct .pos, even if your mouse cursor is over the ")" part of "nickname)". In other words, can it work both ways at the same time?

I was able to implement a change that seems to work, however it is a kludge, is not pretty, and it is hard to tell if there are any side-effects. This change will be in the next beta. If it does have side-effects, I will need to undo it and we will have to live with the current behaviour until the hotlink feature is re-designed.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Just checking/making sure, is the fix implying that if $hotlink(match).type == nick, then $hotlink(match) always contains the correct nickname, that mIRC won't delete some '`' characters like I was reporting?


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard