mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 4,149
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
I hope this helps resolving this problem. It would explain why I never was able to reproduce it: it depends on line wrapping, so on the resolution and the font used.

Anyway, here is a sample of code that should not work correctly whatever the font and the resolution:
Code:
//window -j10 @a | var %a 10 | while (%a) { echo @a $str(%a,500) | dec %a }
Which only displays 6 lines (as in $line(@a,0) is 6) for me.

In my case, since the wrap of $str(%a,500) is taking three *real* lines, the following displays nothing at all:
Code:
//window -j2 @a | var %a 2 | while (%a) { echo @a $str(%a,500) | dec %a }
Same with -j1 and with %a being 1, and this displays only one line:
Code:
//window -j3 @a | var %a 3 | while (%a) { echo @a $str(%a,500) | dec %a }


Finally, this might not be a bug but should still be changed, if the limit put with -jN is greater than the global setting (alt + o > others), the limit is bound to the global setting, it's not really useful to have -j working only for lower value than the global one..


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2006
Posts: 4,149
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Well after working again on that buffer issue, I was trying those examples again and figured the first one was actually working correctly, I thought a line wrapped into X lines would still count as one, somehow. The others example are however not really working as one would expect.

Anyway, there's a difference with what $line reports and what the window displays:
Note: my windows are maximized and $str(1,500) is wrapped into three lines when being displayed.
Code:
//window -ehj5000 @a | var %a 5000 | while (%a) { echo @a %a | dec %a }
In the Window's menu in the menubar, select @a, and echo $str(1,500)
At this point, check with /echo -s $line(@a,0), the value is 4998, but the window correctly has 5000 lines.
Echo that long string again and $line(@a,0) is 4996, there is still 5000 lines in the window.

It's also possible to delete lines from the buffer:
Code:
//window -ej2 @a | echo @a test | .timer 1 1 echo -a $str(1,500)
Should result in the window being empty.

And with a buffer of 5000 lines:
Code:
//window -ehj5000 @a | var %a 5000 | while (%a) { echo @a $str(%a,10) | dec %a } | var %b 1667 | while (%b) { echo @a $str(1,500) | dec %b }
This first displays 5000 small lines, then displays 1667 times a line that is wrapped into three lines, 1667*3 being 5001. Visually, you can see that the window contains only blocks of three lines, which means there is probably 4498 lines.

Now I'm not really sure how one would handle those situations but $line is clearly buggy, and those behaviors are not really expected, I suspect this is what is happening to people in the others thread. Note that the big script in this thread is pointless since $line is affected regardless of the buffer issue.

Last edited by Wims; 27/11/12 05:31 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
Thanks I have been able to reproduce this issue and it has been added to my to-do list.


Link Copied to Clipboard