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
When $nick() uses a not-present nick or an invalid index number with the .color prop, it returns 0 instead of $null, indicating the color is white

//echo -a $nick($chan, nosuchnick).color should be null instead of zero

For this next example I had to insert an extra 9999 check because it was difficult to get it to respond to control break to exit the infinite loop

//var %i 1 | while ($nick($chan,%i).color != $null) { echo -a i= %i nick= $nick($chan,%i) color= $v1 | inc %i | if (%i > 9999) halt }

edit: the .idle property is also returning zero for these same cases

Last edited by maroon; 25/11/20 10:35 AM.
Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
Quote
When $nick() uses a not-present nick or an invalid index number with the .color prop, it returns 0 instead of $null

This behaviour is actually present in many identifier properties. Some return a default value if no match is found, others return $null. The behaviour is somewhat arbitrary - probably based on what a particular scripter requested at the time it was implemented. In this case, this has always returned a default value.

Quote
edit: the .idle property is also returning zero for these same cases

The same applies to this property.

In general, if you want to check if something exists, you need to check for the item itself ie. $nick($chan,nick), without properties. In many cases, a return of $null for a property can be perfectly valid.


Link Copied to Clipboard