mIRC Home    About    Download    Register    News    Help

Print Thread
@window event #67159 09/01/04 09:53 AM
Joined: Sep 2003
Posts: 584
B
bunar Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Sep 2003
Posts: 584
is there a code for event like this:

on @window open, play something.wav or midi or whateva

?

Re: @window event #67160 09/01/04 10:31 AM
Joined: Jan 2004
Posts: 26
M
module Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Jan 2004
Posts: 26
ON *:OPEN:@WINDOW_NAME_HERE:{
Commands
}

For more information on this in mIRC type /help on open


It's not in the GUI, it's in the source.
Re: @window event #67161 09/01/04 11:07 AM
Joined: Sep 2003
Posts: 584
B
bunar Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Sep 2003
Posts: 584
thank you so much !

Re: @window event #67162 09/01/04 11:17 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
The /help on open page mentions that the OPEN event does not trigger for custom windows.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: @window event #67163 09/01/04 12:42 PM
Joined: Sep 2003
Posts: 584
B
bunar Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Sep 2003
Posts: 584
so is this code correct huh?

(not eh?) then which one is it?

Re: @window event #67164 09/01/04 01:02 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
There's no event for that. Your best alternative is a /timer.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: @window event #67165 09/01/04 01:41 PM
Joined: Jan 2004
Posts: 7
K
krvabo Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
K
Joined: Jan 2004
Posts: 7
couldn't you use
Code:
on *:TEXT:*open friggin' window*:#: {
window -l @window
beep
aline @window I said beep
}

?


-------------------------------------------------------------------
mIRC 6.03 :Y)
Re: @window event #67166 09/01/04 02:19 PM
Joined: Dec 2002
Posts: 774
T
theRat Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
Why don't you just play the sound when you open the @window?


Code:
//if ( khaled isgod ) echo yes | else echo no
Re: @window event #67167 09/01/04 02:30 PM
Joined: Jan 2004
Posts: 26
M
module Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Jan 2004
Posts: 26
My fault, sorry for the misinformed information...


It's not in the GUI, it's in the source.
Re: @window event #67168 09/01/04 03:17 PM
Joined: Sep 2003
Posts: 584
B
bunar Offline OP
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Sep 2003
Posts: 584
well thatz exactly what i want (when window opens something should played) but what code is it?

Last edited by bunar; 09/01/04 03:18 PM.
Re: @window event #67169 10/01/04 03:31 PM
Joined: Apr 2003
Posts: 414
Adrenalin Offline
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
Code:
Alias Window {
  if (@* iswm $1) var %Window = $1
  else var %Window = $2
  if (!$window(%Window)) play ZdobSiZdubCoolSound.wav
  window $1-
}


mIRC Chm Help 6.16.0.3 Full Anchored!
Re: @window event #67170 10/01/04 05:52 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
how many times does someone open a window with no switches, you really need to check up to $4, then again what if its a -c for close, or the window already exists, and after you managed all that, and coded for all possablities, oh no someone went and said !window.

A timer would be alot easier, and if its a sound to be heard, i would guess the windows gonna remain open, so a 1 seconds time would liekly be enough,

Re: @window event #67171 10/01/04 07:50 PM
Joined: Apr 2003
Posts: 414
Adrenalin Offline
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
Code:
Alias Window {
  var %Window = $matchtok($1-, @, 1, 32)
  if (!$window(%Window)) echo -set Taram!
  window $1-
}


And why coder must use ! if the /window work exactly like normal(just not support the quietly mode).

The timers will take too much resource.. And why use timers if that can be do very easy with my alias..
Quote:
A timer would be alot easier

Can you show my you code.. I can't imagine..


mIRC Chm Help 6.16.0.3 Full Anchored!
Re: @window event #67172 11/01/04 02:22 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
on your revised code, try these....
/debug @blah1
(window created but no sound and/or message)

/window -c @blah2
(no window created but a sound and/or message)


On why a coder migth use !, basicly becuase they MIGHT, if this person was writting the code that opened the window they want a sound to play on opening, im sure they could just play the sound, so based from there request I would be quite sure that the code that opens the window(s) is not theres, I would beleive there attempting to play sounds to help notify them when a particular window from someone elses script opens.

Timers take stuff all resources, its not like Mircs going hard out now is it.
Why use timers when it can be done with your alias, basicly becuase your alias may or may not work depending on how the window was created.

I didnt have any code, so i wrote this just now, i test ran it and it seems to work ok, it might need more debugging but seemed ok, as an example, it deals with 3 windows it detects opening, giving a sound message for each if it detected an open, it also detects if the window was renamed to the window from another name, but wont detect a rename if the original window was closed at the same time (i do this to block windows being closed, using on close, i create a duplicate window, rename and let the old one close)
The code isnt optimized much as its just an example, also i wouldnt normally hard code 3 windows in, but rather use a hash table, but for the example i felt it was fine.
Code:
 
open.window.detector.startup {
  ;
  ; lets have 3 monitored windows, list the NAME STATUS(0=closed/1=open) SOUNDFILE
  set %owd.window.data.1 @blah1 ? DF.MP3
  set %owd.window.data.2 @debug ? DC.MP3
  set %owd.window.data.3 @xdccklipper ? DS.MP3
  ;
  ; correct there STATUS
  %owd.window.data.1 = $puttok(%owd.window.data.1,$iif(($window($gettok(%owd.window.data.1,1,32)) == $null),0,1),2,32)
  %owd.window.data.2 = $puttok(%owd.window.data.2,$iif(($window($gettok(%owd.window.data.2,1,32)) == $null),0,1),2,32)
  %owd.window.data.3 = $puttok(%owd.window.data.3,$iif(($window($gettok(%owd.window.data.3,1,32)) == $null),0,1),2,32)
  ;
  ; Start the monitoring timer
  .timer.open.window.detector -o 0 1 open.window.detector.timer
}
open.window.detector.timer {
  ;
  ; load w1,2,3 with window NAME & STATUS (used local vars as why do the gettoks in the if over and over %i times)
  var %w1 = $gettok(%owd.window.data.1,1-2,32)
  var %w2 = $gettok(%owd.window.data.2,1-2,32)
  var %w3 = $gettok(%owd.window.data.3,1-2,32)
  ;
  ; loop through all the windows open
  var %w
  var %i = $window(0)
  while (%i) {
    ;
    ; get CURRENTWINDOW
    %w = $window(%i)
    ;
    ; if CURRENTWINDOW 0(closed) NAME & STATUS of a monitored window (and that STATUS is closed) then Play the open sound, cause its now open.
    if (%w 0 == %w1) splay $gettok(%owd.window.data.1,3-,32)
    if (%w 0 == %w2) splay $gettok(%owd.window.data.2,3-,32)
    if (%w 0 == %w3) splay $gettok(%owd.window.data.3,3-,32)
    ;
    ; i cant rember why this is here <grin>
    dec %i
  }
  ;
  ; correct there STATUS (i thought about doing this in the If statments, it would reduce code per execution, but worried if there status could get outa sync with there real status)
  %owd.window.data.1 = $puttok(%owd.window.data.1,$iif(($window($gettok(%owd.window.data.1,1,32)) == $null),0,1),2,32)
  %owd.window.data.2 = $puttok(%owd.window.data.2,$iif(($window($gettok(%owd.window.data.2,1,32)) == $null),0,1),2,32)
  %owd.window.data.3 = $puttok(%owd.window.data.3,$iif(($window($gettok(%owd.window.data.3,1,32)) == $null),0,1),2,32)
}
 


(repeated below as inside code blocks it cant be copied ok)

open.window.detector.startup {
;
; lets have 3 monitored windows, list the NAME STATUS(0=closed/1=open) SOUNDFILE
set %owd.window.data.1 @blah1 ? DF.MP3
set %owd.window.data.2 @debug ? DC.MP3
set %owd.window.data.3 @xdccklipper ? DS.MP3
;
; correct there STATUS
%owd.window.data.1 = $puttok(%owd.window.data.1,$iif(($window($gettok(%owd.window.data.1,1,32)) == $null),0,1),2,32)
%owd.window.data.2 = $puttok(%owd.window.data.2,$iif(($window($gettok(%owd.window.data.2,1,32)) == $null),0,1),2,32)
%owd.window.data.3 = $puttok(%owd.window.data.3,$iif(($window($gettok(%owd.window.data.3,1,32)) == $null),0,1),2,32)
;
; Start the monitoring timer
.timer.open.window.detector -o 0 1 open.window.detector.timer
}
open.window.detector.timer {
;
; load w1,2,3 with window NAME & STATUS (used local vars as why do the gettoks in the if over and over %i times)
var %w1 = $gettok(%owd.window.data.1,1-2,32)
var %w2 = $gettok(%owd.window.data.2,1-2,32)
var %w3 = $gettok(%owd.window.data.3,1-2,32)
;
; loop through all the windows open
var %w
var %i = $window(0)
while (%i) {
;
; get CURRENTWINDOW
%w = $window(%i)
;
; if CURRENTWINDOW 0(closed) NAME & STATUS of a monitored window (and that STATUS is closed) then Play the open sound, cause its now open.
if (%w 0 == %w1) splay $gettok(%owd.window.data.1,3-,32)
if (%w 0 == %w2) splay $gettok(%owd.window.data.2,3-,32)
if (%w 0 == %w3) splay $gettok(%owd.window.data.3,3-,32)
;
; i cant rember why this is here <grin>
dec %i
}
;
; correct there STATUS (i thought about doing this in the If statments, it would reduce code per execution, but worried if there status could get outa sync with there real status)
%owd.window.data.1 = $puttok(%owd.window.data.1,$iif(($window($gettok(%owd.window.data.1,1,32)) == $null),0,1),2,32)
%owd.window.data.2 = $puttok(%owd.window.data.2,$iif(($window($gettok(%owd.window.data.2,1,32)) == $null),0,1),2,32)
%owd.window.data.3 = $puttok(%owd.window.data.3,$iif(($window($gettok(%owd.window.data.3,1,32)) == $null),0,1),2,32)
}

PS : the timer just goes off once a second, as i felt that was a fine rate of scanning, considering its a sound your playing to allert someone whoes then gonna take 10 seconds to get there anyway.

Re: @window event #67173 11/01/04 04:15 PM
Joined: Apr 2003
Posts: 414
Adrenalin Offline
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 414
Quote:

/window -c @blah2

Why coder must use /window -c @blah2 if custom-window @blah2 don't exist ? If that is so big problem.. The if(-*c* iswm $1) will solve the problem..

Quote:

/debug @blah1

Forget about debug, but that alias will also help the coder wink

Code:
Alias Debug {
  var %Window = $matchtok($1-, @, 1, 32)
  if (!$window(%Window)) echo -set Taram!
  debug $1-
}


You code is a solution.. But imo my solution is better.. And faster..


mIRC Chm Help 6.16.0.3 Full Anchored!
Re: @window event #67174 11/01/04 11:21 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I do "/window -c @blah" all the time, the command does not error when the window is not present, and it allows me to set new parameters for the window in the next /window

Well if u cover for all posabilities then ill give you that your alias well work and now your having to monitor debug as well, but you again still cant catch !window or !debug, and i have answered why the coder may do this, basicly becuase the person wanting to intercept the open window event isnt the coder, but someone else. The original request was for how to code for an event, well if there is no "on event" & u cant trap all of the occurances of the event with an alias, your down to only one thing that I know a timer to monitor the situation, and report back or take action as needed.

My solution is by no means fool proof, its only checking once a second, if i wanted to take actions beyond just playing a sound, i would have to monitor a lot closer than that, and even then, a whole script well be run before my timer gets another chance to have a look at whats happened, and as well all know, a script can run for a long long time.