mIRC Homepage
Posted By: ParadoxDragon on HIGHLIGHT - 22/05/12 07:15 AM
'on HIGHLIGHT' that would trigger when something in your highlights list was triggered so that you could stop/modify the highlight (but not the text)
Posted By: Wims Re: on HIGHLIGHT - 22/05/12 03:48 PM
This has been requested in the past but an operator like "if ($1- ishl) { }" would be better: you could use it inside an on text event to know if you have to highlight, but you could use it anywhere else too.
Posted By: argv0 Re: on HIGHLIGHT - 22/05/12 06:41 PM
The functionality of an operator-like condition already exists:

Code:
if ($highlight($1-) != $null) { ... }
Posted By: Wims Re: on HIGHLIGHT - 22/05/12 08:09 PM
Yeah but this doesn't really work, it fails on a case where $1- is a number for example

Edit: https://forums.mirc.com/ubbthreads.php?ubb=showflat&Board=6&Number=218616&Searchpage=3&Main=40604&Words=%24highlight&topic=0&Search=true#Post218616
Posted By: argv0 Re: on HIGHLIGHT - 22/05/12 10:08 PM
No, it does really work, you just have to pay attention to the $0 == 1 && $1 isnum case, as mentioned in the referenced thread. That's not really a significant workaround.

Note that as mentioned in the thread, this is an inherent limitation in mIRC syntax, not the identifier. The solution is not to switch everything over to operators, that would only limit mIRC more as a language. Note also that operators themselves already suffer from similar syntactic ambiguities (like: if (ishl ishl ishl) { ... }), so creating an operator doesn't really solve every case either.
Posted By: TC_Hessen Re: on HIGHLIGHT - 14/04/13 03:40 PM
I know it's an older thread, but I am finetuning a script right now and had the same problem.

Sure I can check the case text==number. But an ON HIGHLIGHT could have much better performance, because mirc have to trigger this event only when a highlight occures.

A ON TEXT will be triggered every time, so during a high traffic chat ( flood attack) this can make some problems.
Posted By: argv0 Re: on HIGHLIGHT - 15/04/13 06:28 AM
Originally Posted By: TC_Hessen
A ON TEXT will be triggered every time, so during a high traffic chat ( flood attack) this can make some problems.


Eh, a hypothetical performance problem is not a real performance problem. Come back with benchmarks and I'll buy it. Also you can't really consider malicious floods since (a) you would probably trigger mIRC's internal Flood protection or (b) you could easily script your own (disable groups on a timer). Keep in mind that you would want this same flood protection for your ON HIGHLIGHT script too, since with well crafted data, a flood could trigger ON HIGHLIGHT as many times as the ON TEXT script listed above. High legitimate traffic is really the only issue that would be of concern.
Posted By: sparta Re: on HIGHLIGHT - 15/04/13 09:20 AM
You can use levels on users, when a word is "highlighted" add the user that trigged it to a level, then unset the level after 3 - 5 sec. Or disable all hightligts with the #group off/on as argv0 said.
Posted By: Wims Re: on HIGHLIGHT - 18/01/18 11:23 PM
No, this really does not work. checking if $0 == 1 && $1 isnum is not enough to make it correct, as explained in this thread. My argument remains, having an operator for if statement like ishl would be much better than an event such as on highlight, on highlight would not allow you to check for highlight against any given string, which would be limited.

Bumping this because it came up on IRC again, even if there is actually a way to script this, it becomes non trivial, an ishl operator would be very nice to have.
Posted By: Khaled Re: on HIGHLIGHT - 19/01/18 10:26 AM
There are no plans to add anymore named operators. They only exist for backwards compatibility. All new methods use the $identifier() format. Does $highlight(text) not do what you are asking already?
Posted By: Wims Re: on HIGHLIGHT - 19/01/18 12:46 PM
Ah well that's good to know.

The problem of $highlight is that non technical user cannot just use "if ($highlight(text)) { do something }"

The above code fails on various occasion:

if 'text' is a number, you get a false positive, if you check the simple "if (text !isnum)", it fails on 1.1, but 1.1 for 'text' wouldn't be a problem in if ($highlight(text)).

If your highlight entry is set to use the method 'nick', you cannot use if ($highlight(text)), you have to loop over $highlight(N), check if that entry is a nick method match with $highlight(N).nicks, then use the nickname, such as $nick, rather than the 'text', in a custom if statement (which would depends if you are using regex match or wildcard (and this is extremely tricky because I believe non regex match are handled in a very special way by mIRC, a bit like how hotlink are handling surrounding characters to nickname, even for a non-beginner user, one has to figure out how mIRC is making the match exactly))

So basically one has to always loop over $highlight(N) and check the various property .regex .cs .nicks and use the appropriate if statements, something like what horst was mentioning in the thread I linked to in my previous post, also more or less shown here

It cannot be expected for non tech user to figure out all of this, it's not impossible to do for sure, $highlight() does provide a way to do it, but I still think mIRC should have something for it.

Perhaps something like $ishighlight(text,[nickname]) returning $true/$false, with a corresponding $ishighlight.type returning the type ("message", "nickname", or "both") and $ishighlight.entry returning the Nth entry (returning the entry itself would be an issue to access $highlight() properly, if it's a number for example) of the last call to $ishighlight()
Posted By: Wims Re: on HIGHLIGHT - 20/01/18 01:37 PM
Correction: $ishighlight.type couldn't possibly return "both", it would return the type of match that was used to find a match, which can only be "message" or "nickname"
© mIRC Discussion Forums