mIRC Homepage
Posted By: RRX $wid - 01/04/07 06:07 PM
Help: Returns window id for current script.

I do this:
dcc chat %nick | var %wid = $chat($chat(0)).wid
..and I store that %wid in a custom window together with some other data.

Then, in the
on ^*:OPEN:=:{ ... }
event, I use $wid to get the attached data from the @window.

But, it's not the same one. For ex, it stores 1804 after /dcc chat and in the on open, $wid is 54, being the one of the status window.

What am I doing or assuming wrong here?
Posted By: Rand Re: $wid - 01/04/07 08:49 PM
That isn't very clear. I'm having a hard time understanding what you're trying to do.

If you provided some actual code it'd be easier for us to see what you're trying to do.
Posted By: RoCk Re: $wid - 01/04/07 09:10 PM
Try using $chat(%nick,1).wid instead of $chat($chat(0)).wid

$chat(0) returns the number of open chat windows.
Posted By: jaytea Re: $wid - 02/04/07 01:00 AM
Originally Posted By: RoCk
Try using $chat(%nick,1).wid instead of $chat($chat(0)).wid

$chat(0) returns the number of open chat windows.


$chat(%nick,1) isnt guaranteed to refer to the chat session assosciated with the open event

here's a trick i saw qwerty using a while ago, $wid doesnt return the correct value in the event, but you can catch its value with the following:

Code:
alias -l getwid %wid = $wid | return =

on ^*:open:$($getwid):{  }


then %wid returns the correct window ID inside the event
Posted By: RRX Re: $wid - 02/04/07 01:56 PM
Thanks. That 'trick' worked.
I recently changed the DCC stuff in my script to use $wid as main reference. So I need now to apply this workaround for every event that uses it.
What is the story behind this? Is it a bug? Should it be reported?
Since you and others already had a workaround from the past, I guess its not fixable or changeable for some reason, compatibility or.. whatever?

© mIRC Discussion Forums