If you use this, you'll be limited to what $snicks and $chan returned only when you called the dialog. You won't be able refresh the data from inside the ON DIALOG event, even calling aliases, signals or whatever, never again.
Then, if you can't refresh your custom $snicks list, what's the point of using it? If you change the active channel, your script will completely fail, unless if you access it from another separate block of code and that's what I think neophyte calls a "hideous" solution.
Please test what you suggested carefully and confirm what I'm saying yourself. I added the event and modified your 'bleh' alias, just to prove my point - but it's still the same thing you posted, as you see:
dialog bleh {
option dbu
size -1 -1 200 200
title "Bleh testing"
edit "",1, 1000 1000 1000 10, hide
list 2, 1000 1000 1000 10, hide
}
alias bleh { dialog -m bleh bleh }
alias bleh.refresh {
did -ra bleh 1 $chan
did -r bleh 2
didtok bleh 2 44 $snicks
}
alias -l blehchan { return $did(bleh,1) }
alias -l blehsnick { return $did(bleh,2,$1) }
;## It works here, no surprises.
alias not_an_ondialog_event {
bleh.refresh
echo -s The active channel appears -> $blehchan
echo -s The 1st selected nick from the active channel appears -> $blehsnick(1)
}
;## It DOESN'T work here. With the same code from above.
on *:dialog:bleh:*:*:{
bleh.refresh
echo -s The active channel DOESN'T appear -> $blehchan
echo -s The 1st selected nick from the active channel DOESN'T appear -> $blehsnick(1)
}
Test it:
- join a channel, select some nicks;
- type /bleh;
- move your mouse inside the dialog, click it, do whatever you want with it - your aliases will always return $null;
- close the dialog;
- type /bleh, move your mouse away from the dialog;
- type /not_an_ondialog_event - your aliases will work.
Well, I tested it here in a plain mIRC. 6.03.
-edit-We already know that it wouldn't work this way, but I showed it just to explain what I think it's neophyte's situation. Well, if it's not, it's still a hideous situation. I'll be glad if you find any way to refresh any custom $snicks/$chan/whatever that isn't messy. I can't think of any.
-edit 2-Ok, for $chan you could just put "
if ($active ischan) { %$chan = $active }" in the refresh alias, since $active works inside ON DIALOG events... and then use %$chan and stuff.
But should we stay here refreshing variables before any small piece of code in a dialog event that needs them? It would be much better if we didn't need to fix mIRC's job, anyway. (Maybe this isn't it's job, but it would help a lot and we're on the suggestions board)