mIRC Home    About    Download    Register    News    Help

Print Thread
Idle time and $findfile #105441 16/12/04 03:44 AM
Joined: Dec 2004
Posts: 7
M
MyNe Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Dec 2004
Posts: 7
when somebody send me prv msg whit "find *.ini" i whont to send prv msg whit all ini files i have in my pc. i make someting but if are many files i flood me and that person i send prv msg.
sow i whont to send him location of files vevery 2 secons not all in 1 second. send file location wait 2 sec send again nex file location wait again 2 sec, etc
look what i do. what i ned to change to send prv msg vevery 2 seconds whit next file location?

on *:text:*:?:{
if ($1 == find) { /msg $nick $findfile(c:\,$2,0,/msg $nick $1-) }
}

and now idle time.
when i am whit someone on prv i whont to show me in title bar idle time of that user and i whont to refresh this at every 2 sec

that is all... for the moment grin

Re: Idle time and $findfile #105442 16/12/04 04:41 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on *:text:*:?:{
  if ($1 == find) { 
    set %mnff.count. $+ $nick 2
    .timer 1 %mnff.count. [ $+ [ $nick ] ] /msg $nick [ $findfile(c:\,$2,0,msg.nick.findfile $1- ) ]
    unset %mnff.count. $+ $nick
  }
}
msg.nick.findfile {
  .timer 1 %mnff.count. [ $+ [ $nick ] ] /msg $nick $1-
  inc %mnff.count. $+ $nick 2
}


That well do it but isnt the best code i have ever written i must admit. Ill come back with one that uses a window, better test it tho first.

Re: Idle time and $findfile #105443 16/12/04 05:33 AM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on *:text:*:?:{
  if ($1 == find) {
    window -c @mnff. [ $+ [ $nick ] ] 
    window -ehnv @mnff. [ $+ [ $nick ] ]
    aline @mnff. [ $+ [ $nick ] ] $findfile(c:\,$2,0,aline @mnff. [ $+ [ $nick ] ] $1- )
    .timer.mnff.dispatcher. [ $+ [ $nick ] ] -o 1 2 mnff.dispatcher $nick
  }
}

mnff.dispatcher {
  if (($line(@mnff. [ $+ [ $1 ] ],0)) && ($status == connected)) {
    msg $1 $line(@mnff. [ $+ [ $1 ] ],1)
    dline @mnff. [ $+ [ $1 ] ] 1
    .timer.mnff.dispatcher. [ $+ [ $1 ] ] -o 1 2 mnff.dispatcher $1
  }
  else {
    window -c @mnff. [ $+ [ $1 ] ]
  }
}


Thats alot better than the first one as you only have one timer running rather than one for each line, which is pretty rude unless you know your never going to do more than a few lines.
The on text event kills any existing window, cretas a new one, loads it with the files found, then starts a once off 2 second timer
The timer checks theres contents in the window and its connected, then sends the top line of the window and deletes it, and calls itself in 2 seconds, otherwise the timer just closes the window, and exits.

PS: i know a timer could be set to do x repetitions but i like using the self calling method as in other processing loops, some times depending on what i just processed i well do a /timer 1 0 (process next line etc straight away) or a /timer 1 x (process next line etc in x seconds)

Re: Idle time and $findfile #105444 16/12/04 11:40 AM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You don't need any of the square brackets there, you can remove them all.

Apart from that, this method could still flood somebody off if lots of people issue "find" within a small period. Although your script can be modified to take care of that, I'd use a simpler method, /play: any subsequent /play's issued while the previous /play hasn't finished are queued.
Code:
on *:text:find *?:?:{
  var %f = $ticks $+ find.tmp
  .fopen -o %f %f
  if $findfile(c:,$2-,0,.fwrite -n %f $1-) { .play $nick %f 2000 }
  .fclose %f
  .remove %f 
}


MyNe: about the idle time in titlebar, the short answer is that it's not possible.

Last edited by qwerty; 16/12/04 11:45 AM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Tnx #105445 16/12/04 02:05 PM
Joined: Dec 2004
Posts: 7
M
MyNe Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Dec 2004
Posts: 7
Tnx a lot for all help.

Re: Idle time and $findfile #105446 16/12/04 03:09 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
You don't need any of the square brackets there, you can remove them all.


I find its easier to just put them in everytime than sort out which ones are requiered and which ones are not, also menas i can copy and paste the variable name quickly, and or locate every instance, but yeah ill agree with ya they are liekly not needed smile

Quote:

Apart from that, this method could still flood somebody off if lots of people issue "find" within a small period.


I new play worked like that, but didnt really like the idea of queueing up someone elses info behind the previous guys, i thought, most people well send the request, get no response and try it again 4 to 5 times, queueing up 5 repeats, that of course could be fixed easy etc with a message or some type of requester check system.

The only thing in your script i wondered about was if you can do a " .remove %f " like that, wont the /play still be working its way through the file ? or does it buffer it to some temp location?

Re: Idle time and $findfile #105447 16/12/04 04:03 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Quote:
I new play worked like that, but didnt really like the idea of queueing up someone elses info behind the previous guys [...]

Valid point, I believe the -mN switch is useful in this case. It could also be combined with -qN, to adjust the total length of the queue.
Code:
on *:text:find *?:?:{
  var %f = $ticks $+ find.tmp
  .fopen -o %f %f
  if $findfile(c:,$2-,0,.fwrite -n %f $1-) { .play [color:red]-m1[/color] $nick %f 2000 }
  .fclose %f
  .remove %f 
}



Quote:
or does it buffer it to some temp location?

That's what it does.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: Idle time and $findfile #105448 16/12/04 04:32 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
I believe the -mN switch is useful in this case. It could also be combined with -qN, to adjust the total length of the queue.


Well this guy just scratched his head and went of course thats what that ment, i had read that before, and had made some now totally ilogical looking connection to it being $me the user is only allowed to make x number of plays to channel, while I might have another nick also in that channel /scon 2 $me was allowed to make what ever his -mN was set at, and -qN set a max total plays, Pah! even my explanation of what i thought sounds stupid now!

Quote:
or does it buffer it to some temp location?

That's what it does. [/quote]

I read this line from the help "The -b switch plays text in the clipboard to a window. The text is temporarily saved to a file playqN.txt, which is deleted once playing is completed." and had assumed other /play commands would need the file since that says it deletes it at the end.
Im off to track down some timers i have that delete the files after there been /play'ed, alot simplier now i know it makes a copy, in fact i can just uses a temp.txt rather than unquie filenames since it can be made played and deleted all in one event.
THANKS.