mIRC Home    About    Download    Register    News    Help

Print Thread
#173483 25/03/07 06:01 PM
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
Code:
  var %edit = 12,19,20,21,857,22,860,31,367,368,64,65,68,67,69,73,74,75,78,79,80,102,103,104,120,121,122,123,124,125,126,785,788,967,274, $+ $&
    559,561,565,800,802,805,174,169,813,809,810,429,372,287,516,511,505,502,517,512,506,186,183,188,166,849,426,721,713,851,842,920,852, $+ $&
    724,902,954,960,914,916,918,923,924,925,729,784,708,608,609,610,873,710,520,547,548,821,823,825,827,838,841,868,876,877,899,901,940
did -rb %d %edit

This code cleared unintentionally the text on a button with id 85 (which is no 44 token in variable %edit), and, despite the -rb switches, still was clickable, so -r worked for it and -b didn't.

I changed the code to:
Code:
  var %edit = 12,19,20,21,857,22,860,31,367,368,64,65,68,67,69,73,74,75,78,79,80,102,103,104,120,121,122,123,124,125,126,785,788,967,274, $+ $&
    559,561,565,800,802,805,174,169,813,809,810,429,372,287,516,511,505,502,517,512,506,186,183,188,166,849,426,721,713,851,842,920,852, $+ $&
    724,902,954,960,914,916,918,923,924,925,729,784,708,608,609,610,873,710,520,547,548,821,823,825,827,838,841,868,876,877,899,901,940
  did -rb %d $gettok(%edit,1-30,44) | did -rb %d $gettok(%edit,31-60,44) | did -rb %d $gettok(%edit,61-,44)

and this did not alter button 85's text anymore.
It looks like something breaks up in /did internally, when the amount id's exceeds some length.

RRX #173525 25/03/07 07:54 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The fact that there is a limit to the number of items you can have representing ID's in a /did command is one of (if not the main) reason Khaled added the option of being able to use ranges.
Code:
var %edit = 12,19,20-22,31,64,65,67-69,73-75,78-80,102-104,120-126,166,169,174,183,186,188,367,368,800,802,805,809,810,813,821,823,825,827,838,841,842,849,851,852,857,860,868,873,876,877,899,708,710,713,721,724,729,784,785,788,901,902,914,916,918,920,923-925,940,954,960,967,274,287,502,505,506,511,512,516,517,520,547,548,559,561,565,426,429,372,608,609,610
did -rb %d %edit

Note: If that still gives you trouble, then split the list of ID's into smaller sections and use a /did for each section
Code:
var %edit = 12,19,20-22,31,64,65,67-69,73-75,78-80,102-104,120-126,166,169,174,183,186,188,367,368,800,802,805,809,810,813,821,823,825,827,838,841,842,849,851,852,857,860,868,873,876,877,899
did -rb %d %edit
%edit = 708,710,713,721,724,729,784,785,788,901,902,914,916,918,920,923-925,940,954,960,967,274,287,502,505,506,511,512,516,517,520,547,548,559,561,565,426,429,372,608,609,610
did -rb %d %edit


In regards to why it cleared 85, in spite of the fact that 85 isn't in the list, You do have 851, 852 and 857 in there, and if the limit for the list of ID's got the 85 of 851 then it would clear 85 (although why it left it enabled is a puzzler)

Note: You must have mIRC 6.17 or higher to use the ranges.
If you don't have 6.17 or higher, I suggest you upgrade, or use something similar to my second suggestion, which doesn't require the ranges.

Additionally, remember that variables have a limit of about 950 characters including the variable name, the = sign and the spaces between the variable name, the = sign, and the assigned value.

Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
If this is considered a fact, a known limit, and new things were added (those ranges) to help getting around this, shouldn't it then be mentioned in the help for /did that there is a limit which is much lower than mIRC's overall string length limit?
It took me two hours to track this down to the command that causes it.
Besides, those ranges are not very practical, when you start writing a script with a dialog, new controls are added and unneeded controls are removed in the progress, to be able to use ranges, that would require re-assigning id's from time to time, which is a pretty work-intensive job if the script becomes bigger. Also, the replace function used with control ids becomes much less usable since the text "86" is not present in "85-87"

RRX #173575 26/03/07 04:53 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
It was mentioned in the versions.txt file at the time of the changes.
Quote:
mIRC v6.2
5.Extended /did to support a long list of ids as opposed to only up to 256 characters.
mIRC v6.17
102.Can now specify a range of ids with one /did command by using a dash, eg. /did -b test 1-5,6,7-8,9-11,10

RRX #173594 26/03/07 01:34 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: RRX
If this is considered a fact, a known limit, and new things were added (those ranges) to help getting around this, shouldn't it then be mentioned in the help for /did that there is a limit which is much lower than mIRC's overall string length limit?


Perhaps, yet there isn't a mention about /var or /set (or any other commands) having a limit, either. There are almost always limits in programming/scripting.


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2004
Posts: 162
R
RRX Offline OP
Vogon poet
OP Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
Originally Posted By: Riamus2

Perhaps, yet there isn't a mention about /var or /set (or any other commands) having a limit, either. There are almost always limits in programming/scripting.

Sure there are always limits, but if there is one limit applied to about everything, and one single exception, the limit for /did, isn't it worth mentioning in the help for it? As said above, it was mentioned in the version changes for a specific mirc version, but a version change text is not a reference as such. If it mentions a new command then its added to the help too.

It's not that big deal, but think of this: how many people found out the, in the meantime well-known-by-experienced-scripters, pitfalls, the hard way, i.e., weird bugs/behaviour, take for example /var with its behaviour when using constructed (dynamic) variablenames etc?
Why letting people every time go through to "wtf?" debugging etc stage, if such things can be mentioned as notes whatever in the help for the related commands?
Those things exist since long time so they aren't really solvable without giving up backwards compatibility I guess, so why not mention them?

RRX #173621 26/03/07 10:05 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I'm not saying they shouldn't be mentioned. And you do have good points. However, the help file (even though it's a great resource) is not updated often. We've all learned to accept that and just use sites like this one to learn how to do various things that aren't shown in the help file. There are some people who put out updated help files, but they still aren't updated as often as people would like. If you or someone else wanted to contribute to updating the help file, then I'm sure it would be appreciated by either Khaled or one of the groups putting out updated help files.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard