mIRC Home    About    Download    Register    News    Help

Print Thread
#174003 01/04/07 06:07 PM
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
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?

RRX #174035 01/04/07 08:49 PM
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
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.

Rand #174037 01/04/07 09:10 PM
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Try using $chat(%nick,1).wid instead of $chat($chat(0)).wid

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

RoCk #174057 02/04/07 01:00 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
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


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #174115 02/04/07 01:56 PM
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
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?



Link Copied to Clipboard