|
Joined: Aug 2006
Posts: 167
Vogon poet
|
OP
Vogon poet
Joined: Aug 2006
Posts: 167 |
Unless I'm wrong, there is currently no capacity for distinguishing between, and sending events to, one of $nick's specific DCC windows if $nick has more than one open in your mIRC client. E.g., with remote scripting in mind, if two DCC chat windows are open to Bob^, there is no Remote Identifier that would be useful in an "ON CHAT" event to determine which DCC Chat window Bob^ just typed in. Also, if two DCC windows of any kind (chat & chat, or chat & fserve, etc.) are open to Bob^, there is no way to send an event to one of those windows in particular, because /msg|/describe =Bob^ <text> will only send to the first DCC window opened to Bob^). How about: (1) Adding a Remote Identifier like $dccwin that returns the $wid of the DCC Chat/Fserve/etc. window an event has occurred in. Then, for example, an "ON CHAT" event would have a way of telling which of Bob^'s multiple DCC Chat windows he typed in. (2) For commands like /msg, /describe, /editbox, /echo, etc., allow an optional ,wid tail on =nick style targets. Then, if I knew Bob's 2nd DCC chat window ID was 12, I could either type "/msg =Bob^,12 Boo!" myself, or in a script, "/msg = [ $+ [ $nick ] $+ ] , [ $+ [ $dccwin ] ] Boo!"). "/msg =Bob^12 Boo!" (without ,wid) could continue behaving as now - sending to Bob^'s first-opened DCC window regardless of its $wid - so that existing scripts wouldn't be broken.) If there's a way to do everything just suggested, I'd love to know, because I've found nothing after RTFM.
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
ON SERV can be used to distinguish between chat and serv dcc windows, the existance of $cd can also be checked.
To the best of my knowledge, both of these events will automatically send any msg =nick commands to the window that triggered them. So it seems the design of mircs scripting language already does this for you. eg.
on *:CHAT:*something*: { msg $+(=,$target) message sent to correct window }
You may also find use of $chat() and $fserv() identifiers. $chat(nick,2).wid should return the wid for the second open dcc chat with nick. An N value of 0 would return the number of dcc chat windows open with nick.
However i did notice that $wid in an ON CHAT event doesn't return unique id's for each chat window at all. Maybe that is a bug? otherwise its a useless identifier in chat/serv events. It seems to always return a 1??
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Your suggestions would be a great help, however for the mean time this might help you... I had the same problem a little while ago, with some pissing around (alot of pissing around actually) i came up with this. (actually this has been slightly rewritten for what you asked) MUST BE LOADED BEFORE OTHER SCRIPTS THAT WISH TO USE $DCCWIDon ^*:CHAT:*:{
var %i = $chat($nick,0), %dcc.chat.sbcolor.values
if (%i > 1) {
while (%i) {
var %wid = $chat($nick,%i).wid
var %dcc.chat.sbcolor.values = $+(%dcc.chat.sbcolor.values $calc($findtok(message highlight event,$window($+(@,%wid)).sbcolor,32)),@,%wid)
window -g0 $+(@,%wid)
dec %i
}
set %dccwid.dcc.chat.sbcolor.values %dcc.chat.sbcolor.values
}
}
on *:CHAT:*:{
var %i = $chat($nick,0), %dccwid.value = $activewid
if (%i > 1) {
while (%i) {
var %wid = $chat($nick,%i).wid
if ($window($+(@,%wid)).sbcolor) {
var %dccwid.value = %wid
break
}
dec %i
}
set %dccwid.dccwid.value %dccwid.value
var %i = $numtok(%dccwid.dcc.chat.sbcolor.values,32)
while (%i) {
var %sbcolor = $gettok($gettok(%dccwid.dcc.chat.sbcolor.values,%i,32),1,64)
var %wid = $gettok($gettok(%dccwid.dcc.chat.sbcolor.values,%i,32),2,64)
if (($window($+(@,%wid))) && ((%wid != %dccwid.value) || (%sbcolor == 2))) {
window $+(-g,%sbcolor) $+(@,%wid)
}
dec %i
}
}
else {
set %dccwid.dccwid.value $chat($nick,1).wid
}
unset %dccwid.dcc.chat.sbcolor.values
.timer 1 0 unset %dccwid.dccwid.value
}
alias dccwid { return %dccwid.dccwid.value }
;
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;
alias type2wid {
if ($0 > 1) {
var %wid = $+(@,$gettok($1,1,64))
if ($window(%wid)) {
if ($editbox(%wid)) {
set $+(%,type2wid.wid.,%wid,.editbox) $editbox(%wid)
.timer 1 0 editbox $+(-,$iif(($right($editbox(%wid),1) == $chr(32)),p),b,$editbox(%wid).selstart,e,$editbox(%wid).selend) %wid $+(%,type2wid.wid.,%wid,.editbox) $(|,) unset $+(%,type2wid.wid.,%wid,.editbox)
}
editbox -n %wid $2-
}
}
} **** this script well enable you to sample $dccwid in ON CHAT but not in ^ON CHAT ****The alias at the end allows you to enter text into any window by its wid (well screw up if u send it to a window with no editbox) Example script event ** must be in its own script file as the above uses ^on chat & on chat itself **on *:CHAT:*closing idle connection*:{ type2wid $dccwid sends }
|
|
|
|
Joined: Aug 2006
Posts: 167
Vogon poet
|
OP
Vogon poet
Joined: Aug 2006
Posts: 167 |
Hey, awesome! Thanks very much for that! If Khaled chooses to add the functionality I was referring to in my original post, this will nicely hold me over until that time arrives. And if not, then permanently. Incidentally, on the subject of it being added, I suppose that in addition to the all-important /msg, /describe, /editbox, and /echo commands, being able to /close by $wid would be necessary as well. Guess it was pretty silly forgetting that one.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Assuming %wid has the wid in it then it is window -c $+(@,%wid) (well not work on some windows channel/status1 for obvious reasons)
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
Agreed, there should be a way to retrieve the wid of the associated window, as well as target commands like /msg to the chat instance you want. For the first, it would be nice if $chat(-1).wid did that (like $get(-1) and $send(-1) in the on FILERCVD etc events). For the second, simply /msg <wid> <text> would do the trick, since no chat, channel or query window name can be a number (or perhaps follow the window manipulation commands format, ie /msg @<wid> <text>). A workaround for the first issue, however, can be pretty simpler and made to work in ^-prefixed on CHAT events too. Put this in your first loaded file: on ^*:chat:$($storecwid):{ }
alias storecwid set -u1 %cwid $wid Then in your on CHAT events, use %cwid to get the wid of the associated window.
Last edited by qwerty; 21/09/06 12:11 AM.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
on ^*:chat:$($storecwid):{ }
alias storecwid set -u1 %cwid $wid Sigh , serves me right for assuming that becuase $wid was 1 in the event it was 1 in the comparasion as well. Well i just replaced my code in other things with yours thanks!!!, or something close to it alias getwid { set -u1 %getwid $wid | return $1 } on ^*:chat:$($getwid(*)):{ ... uses %getwid ... } * I never liked the having to have a seperate script to pull it so made it do it inside the actual ON CHAT that trips it. Thanks again.
|
|
|
|
Joined: Nov 2004
Posts: 842
Hoopy frood
|
Hoopy frood
Joined: Nov 2004
Posts: 842 |
What do you do at the end of the world? Are you busy? Will you save us?
|
|
|
|
|