mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2019
Posts: 45
Q
quartz Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Dec 2019
Posts: 45
I have a standard %loop reading lines from a txt file, there are (at the moment) 35,000 lines in the file

so the %loop is very rapid. in the loop, if I put " /echo -s %loop " in each loop (or pref updating a single line of a @window), mIRC stops the update message after 3-4-500 lines (continues to run the script). presumably the /echo takes second priority to running the script (or something)

is there any way to set it so mIRC will make sure it continues to run (display) the /echo line?

Last edited by quartz; 29/03/20 09:06 PM.
Joined: Dec 2011
Posts: 18
J
Pikka bird
Offline
Pikka bird
J
Joined: Dec 2011
Posts: 18
You should explore the /play command. It much more versatile in how txt files are accessed and displayed.

Joined: Feb 2011
Posts: 448
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 448
The /echo command is still running. mIRC is single threaded so if the while loop is large enough it will freeze the UI and everything else while it does the loop.

Using /echo during a while loop slows it down if its being printed into a window. It will drastically slow down if its being printed in the active window.

After the while loop is done you can scroll up the window and see everything.

Code
; No Echo.
//var %a $ctime | var %x 100000 | while (%x) { dec %x } | echo -ag Time: $calc($ctime - %a) seconds.
Time: 1 seconds.

; Echo into status window while looking at another window.
//var %a $ctime | var %x 100000 | while (%x) { echo -sg %x | dec %x } | echo -ag Time: $calc($ctime - %a) seconds.
Time: 8 seconds.

; Echo into active window.
//var %a $ctime | var %x 100000 | while (%x) { echo -ag %x | dec %x } | echo -ag Time: $calc($ctime - %a) seconds.
Time: 127 seconds.

Joined: Dec 2019
Posts: 45
Q
quartz Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Dec 2019
Posts: 45
thanx all

ok the while loop still seems to freeze echo'ing after a few 100 lines

thanks John, I dont think the /play will do what I want it to at the moment tho

basically it's a log file, and i'm scanning the log file [line by line], for instances of a certain string, every time the string exists, it increments a %counter

tbh I don't mind it actually taking longer, but it would be nice to see a progress number

Last edited by quartz; 29/03/20 09:23 PM.
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
The command /fupdate may help displaying the lines at a different pace, therefore preventing windows from getting unresponsive, try /fupdate 100 for example.

https://en.wikichip.org/wiki/mirc/commands/fupdate


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2011
Posts: 18
J
Pikka bird
Offline
Pikka bird
J
Joined: Dec 2011
Posts: 18
If it's just matches and a match count you want, use /filter and $filtered.

Joined: Dec 2019
Posts: 45
Q
quartz Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Dec 2019
Posts: 45
that cool. filter definitely works.

not as much fun as a loop counter tho wink

Joined: Dec 2019
Posts: 45
Q
quartz Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Dec 2019
Posts: 45
will check /fupdate

Joined: Dec 2019
Posts: 45
Q
quartz Offline OP
Ameglian cow
OP Offline
Ameglian cow
Q
Joined: Dec 2019
Posts: 45
ok so done a couple test ones

a small %loop going up to 2,000, where the visual counter freezes after about 500, takes "5,000 ticks", and mIRC runs at full 25% cpu

running the command on a millisecond /timer -m, takes about 30,000 ticks, and takes about 4% cpu

on a /timer -h, take about 10,000 ticks, and takes about 12% cpu

so tbh, using a /timer -h seems to be a good option here, only takes twice as long as a %loop , and gives a fully up to date counter

I mean actually /filter is the "functional" solution, but /timer -h also works

Last edited by quartz; 31/03/20 07:36 PM.
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
If you want display a counter and you expect hundreds of matches over 35000 lines, echoing one line to a window is not very good, you could use a dialog and a text button that you increase, or a picture window allow you to create your own progress bar, or simply display the number.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard