The issue, at its heart, is that you should NOT be relying on $did(0) to return anything meaningful to you. As I mentioned in my first post, it is your script's responsibility to guard against using this value:

Code:
if ($did == 0) return | ; I cannot use this ID


Changing the behavior to return $null doesn't solve the problem. The 0 value is reserved and could possibly change in the future, at which point your script will begin to break in unintentional ways. Khaled is doing the right thing (in my opinion) by reserving this value via a hard-error and leaving the opportunity to add standard count-based return values in the future (or whatever), if that's the intention.

The parallel here would be if you were using some identifier that returned an index to be used in $nick(#,N), say $nickid:

Code:
on *:TEXT:*:#:echo -a the nick ID is $nickid


If $nickid ever could return 0, you would want to make sure you guarded against this, because using it as an index would be invalid:

Code:
on *:TEXT:*:#: {
  if ($nickid == 0) return | ; using this wouldn't make sense
  echo -a $nick(#, $nickid).idle | ; idle would not make sense for N=0
}


Furthermore, if you did not guard the value in the above case, you would be returning a collection count instead of the text you wanted, which would be outright incorrect.

The same exact story goes for $did(N), in that $did(0) could eventually start returning a count and would return the wrong result for most script usage blindly using ID input from $did when $did=0. Yours included.

It seems clear to me that this API is intentional, and the "workaround" (it's not actually a workaround, it's a proper guard, but anyway) is extremely simple to add to your script:

Code:
if ($did == 0) return


You might also want to focus on some of my original suggestions too, namely, that you should probably not be using an ID match of "*" for anything outside of debugging. Your dialog will likely have plenty of controls that don't have text or don't have sensible values for properties $did(N), and blindly returning $null is the wrong way to go about writing a script. The correct approach is simply to scope your events to individual IDs, either by the matcher, or via an if statement guard (similar to the one above):

Code:
if ($did !isnum 5-12) return | ; only handle IDs 5 to 12


If this isn't clear I can try and explain better, but you're much better off following these rules than butting your head against intentional design choices. Even if you somehow convinced Khaled to make the above change, you would be waiting until v7.44 (at least) to use this functionality, and your distributed scripts would have a hard requirement on this version when the "workaround" only involves a single line of code. Basically, you could have already solved this problem by now.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"