mIRC Home    About    Download    Register    News    Help

Print Thread
#82085 06/05/04 12:27 PM
Joined: May 2004
Posts: 2
T
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: May 2004
Posts: 2
hi there,
i think i've just found a bug in the $highlight() function:

if you have a on text script like the following:
on 1:TEXT:*:*:{
if ($highlight($1-)) {
echo -a highlight match: $highlight($1-)
}
}

and someone says: "54564564532" then this event will show:

highlight match: 1

...
[14:22:13] <@iw|Tiberius> 54564564532
highlight match: 1
...

i wonder why $highlight() reacts like this, because i've only a highlight on "pap" atm ...
i also checked wether it could be only the $highlight value if highlight is turned on or not - but i tried it both with highlight turned on and off

hf
-tib

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
This is a side-effect of the dual function of $highlight(): the identifier can be used in two ways

1) $highlight(text) - returns the item in Highlight list that matches "text"

2) $highlight(N) - where N is a number, returns the Nth item in the Highlight list, eg $highlight(3) returns the third item.

The reason $highlight(54564564532) returns "1" is the second function. When N is greater than 2^31-1, it is considered 0. So $highlight(54564564532) = $highlight(0) = the total number of items in Highlight list.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Dec 2002
Posts: 230
G
Fjord artisan
Offline
Fjord artisan
G
Joined: Dec 2002
Posts: 230
Although there's a simple workaround (if ($1 !isnum)), I'd suggest a property for $highlight that treats the input as text even if it is just a number.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Agreed, this would solve the problem.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: May 2004
Posts: 2
T
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: May 2004
Posts: 2
aye thank you smile


Link Copied to Clipboard