mIRC Homepage

7.08 - $wid

Posted By: jaytea

7.08 - $wid - 27/07/10 07:19 AM

on *:text:*:?:{ echo -a $wid }

gives the Status Window's WID instead of $window($nick).wid

just a quick report, i didn't test this on other events
Posted By: Khaled

Re: 7.08 - $wid - 27/07/10 09:43 AM

This is by design, almost all events use the server window as the base window, so if a script needs to target a window related to particular event it will need to do so based on the parameters for that event.
Posted By: Raccoon

Re: 7.08 - $wid - 24/01/15 12:00 PM

Are you sure this is intended behavior, Khaled? It seems like the behavior you're referencing is $cid (connection id) instead of $wid (window id).

I think most users expect On Text $wid to reference the channel or query or dqwindow that the text event happened in. There can be multiple query windows of the same name, so it would be impossible to pin point which of the multiple query windows the Text was sent to, otherwise. Same with On Chat and several DCC chat windows opened to the same target ... which $wid?
Posted By: Wims

Re: 7.08 - $wid - 02/08/19 09:46 PM


While this design is definitely not desirable for scripters, it's failing with on open, where in combination with this report, it makes it impossible to tell where the message comes from (as Raccoon pointed out)

In most cases, the language is capable of letting us do what we want in events with windows, as in, we simply don't need to know the window id of the window that triggered the events.

However, sometimes we need that value, if you recommend to use the parameter of the event to target a window, with an event such as on *:open:*:!,=:{ or simply on *:open:*:*:{, how do you tell if it's a dcc chat or fserv?

For all practical purpose, it would be nice to have $eventwid, to get the wid of the window that triggered the event, and maybe $eventtype or similar which would return '#', '?', '=', '!', '@', depending on the window associated with the event.
Posted By: maroon

Re: 7.08 - $wid - 02/08/19 10:37 PM

Because DCC CHAT and SERV windows are both named =samenickname, and it's possible to have multiple DCC CHAT windows open to the same nick, "/echo =$nick message" isn't guaranteed to echo to the correct window, instead showing in whichever of the =samenickname windows was opened first. And $window(=$nick).wid would also return the wrong number, and if you have 2 dcc chat windows open to someone, or a dcc-chat and dcc-fserve, then //echo -a $window($active).wid shows the same number in both editboxes.

With something like $eventwid or $wid.event the correct window could be targeted like "/echo @ $+ $window(@ $+ $eventwid).wid message"

It would also be nice to have $window(@number).name to find out the window name associated with a .wid

The syntax shown for /help ON OPEN is confusing because it combines the syntax for ON OPEN with unrelated syntax for ON CLOSE. This makes it looks like ON OPEN requires the matchtext field, the same way it requires the windowtype field, and makes it seem as if it's possible for @custom to trigger ON OPEN. From the examples using ON OPEN without matchtext, it's not obvious that the matchtext field is optional for query windows, and can be present for other window types only if the event handler isn't a 1-liner:

on *:OPEN:*:*:{ echo test $scriptline $event }

/help says * is a valid windowtype for ON OPEN, but the above event handler tries to execute an alias named :{ generating a server error, for all window types except for query. If the echo is moved down to its own row, then there's no error generated. and it does execute the echo correctly after generating the server error.

It's possible to have an alias named :{ to prevent this, but you'd need to give it an unmatched end-brace to prevent the Ctrl+H warning, like:

alias :{ echo -s test }
© 2020 mIRC Discussion Forums