mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2004
Posts: 148
D
Vogon poet
OP Offline
Vogon poet
D
Joined: Nov 2004
Posts: 148
I first noticed it when I created a realy big script (over 500k) and never thought of spliting it to multiple files. Few days later I noticed that the file got corupted and I thought that it might have to do with a HD problem I had (A software called deep freeze doesn't work with Nforce chipsets and it crashed the HD literaly!!!).


After I fixed the corrupted file, I noticed that I can not add new text in the script to the file using the script editor (When I press a key it jues nothing, just like you have a form which is limitted to lets say 20 letters and you are trying to add the 21th letter).


This is not the only problem..... if it was then I wouldn't bother to nag you, but the problem with the script editor is that is corrupts files!!!


For this matter I have created an example:

We will create a "script" (well actualy a text file) which is bigger than 500KB and we will load it into mIRC..... Then I will show you that it gets corrupted.

Lets start with our text builder script:

Code:
  
alias crpt {
  var %a = 1
  while (%a <= 2000) {
    write crpt.txt $str(%a,100)
    inc %a
  }
}




Now lets load the file into mIRC:
/load -rs crpt.txt



Now we will look how the text file look like in notepad:


Looks fine....

Now lets look how it looks lke in mIRC script editor:


You can see that "2000" that should be at the end is now somewhere in the middle!!! NOT VERY GOOD frown

Lets look at the end of the script in the script editor:


You can see that line 1553 is shorter.... The reason for that is that line 1553 was Cutted in the middle!!! The first half is still where it is supposed to be and the next half is near the end.

The line that contains the 1553 was splited exactly at the 500KB !!!



Now lets overwrite one of the numbers in the script editor and then press OK (if we change nothing then presing OK will not save anything into the crpt.txt)

Now lets open the crpt.txt with notepad:



Now the original text file got compeltle corrupted... the order of the lines is messed, the line with 1553 got splited etc.


IMO the file size limit shoule be higher..... yes, I know.... scripts are usualy not that big, but still.


Thanks, and I hope that this problem will be fixed someday (Problem was tested on mIRC 6.16 and 6.17)

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
What type of incredibly over bloated script file is it that it got beyond 500K ?

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I have 47 script files that take up about 1MB of size.

@OP: A single 500kB file seems clumsy and sloppy to me. Entire sections that do similar things should be bunched together into separate files. For example, the dialog tables/events could be in one file, the window commands/events could be in another file, and the IRC events (join, part, etc) could be in another file.

-genius_at_work

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
oh i dont particullly think 1mg of script files are overboard (well depends how much they all do i guess) but 500K in one file!

Not to say you or he does this, but i have noticed in a lot of scripters a bad habbit of reprocduction of identicle code over and over, for things that should ever be called as one alias or indentifier, but instead i see the same code repeated in multiple events, this of course is just hyper intensive to debug, as trap and repair the bug in one place and it still exists in another when all that was really needed was a signle instance of the code, that could have been repaired and all would be fine.

Joined: Nov 2004
Posts: 148
D
Vogon poet
OP Offline
Vogon poet
D
Joined: Nov 2004
Posts: 148
It was just easier for me to put it in one file, cause I never thought I would need to split it.

have few functions which works with sockets (Like email checking, MySQL (server is located on my computer), etc....
I lately added a code that also testing the Invision Board 2.x exploit.... I took the original perl script and I wrote it in mIRC. The reason I did that is because my forum and lots of other forums on the net has been attacked, and I wanted to see what the exploit allows the attacker to do.... which is pratcially anything... as soon as I found out I fixed the problem on my forum and also tested with that script that the exploit is gone).

Anyway, it is not that unusual to see huge scripts, even in PHP...
Never the less, the script editor should not corrupt files.

Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
While i agree that a single script file of that size is sloppy, i think it is irrelevent. mIRC should not corrupt/rearrange the data of the file in any way. Perhapse a warning box should appear when a large file is loaded, and give you the option to either cancel the action, or continue loading the file with fore warning that editing the file in the scripts editor could cause corruption. Maybe even an ok/cancel warning when mirc attempts to save and notices the large file size, to warn that proceeding will result in data loss/corruption.

That is of corse if the limit is kept intact.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
Joined: Jan 2004
Posts: 162
R
RRX Offline
Vogon poet
Offline
Vogon poet
R
Joined: Jan 2004
Posts: 162
I encountered this problem 1,5 years ago and they told me the same as they do here: 500k is called insane and bloated.
They told me the code was too messy and hard to interprete, and gave a couple ideas on how to make script shorter, but turned out to give relatively little gain (maybe 10% at max) and in contradiction, harder to read.

However, I started to work out ways on how to make it more readable. It was a big work and required a complete overhaul, introduced alot new bugs due to typo's, forgets to change something on every place etc.

But in the end, it was very worth the effort.
I did split up the script into 12 files, and it was not easy to write a loader/unloader that guaranteed regardless which script file was loaded or unloaded, all other did the same.
The in 6.17 fixed /load -nrs switch order bug wasted me alot time.

Having more script files has one big advantage during development: when you have 1 scriptfile, you have only one focussed line, when you have 12, every file has a focussed line, so it was alot less scrolling back and forth.

The total scripted size is now 862k and I used any trick I could think of to reduce size without suffering readability/maintainability loss too much so I don't think a statement like "500k??? it -has- to be bloated" is a holy grail.

Joined: Feb 2003
Posts: 26
M
MRN Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Feb 2003
Posts: 26
The limit is 64kb for mIRC 5.91 and 30 for mIRC 5.8 or something. I can't remember when the limits was changed.

The editor just chops off the rest, without any warning, when you save the changes. So I scripted a kind of a backup-script, which copies all my remote files once every month. So I have some sorf of a backup failure, just to be sure. It helped me numerous times!

Joined: Nov 2004
Posts: 148
D
Vogon poet
OP Offline
Vogon poet
D
Joined: Nov 2004
Posts: 148
Quote:
I have 47 script files that take up about 1MB of size.

@OP: A single 500kB file seems clumsy and sloppy to me. Entire sections that do similar things should be bunched together into separate files. For example, the dialog tables/events could be in one file, the window commands/events could be in another file, and the IRC events (join, part, etc) could be in another file.

-genius_at_work




Bill gates, if I recall right, said "640kb ought to be enough for anyone"
And also "We will never make a 32 bit operating system"


In the past OSes took less than 640KB and games were small and effective.... now I see OSes that take 5GB (or even more) games that sometimes bigger than 1 DVD, and it always gets bigger and bigger.


As the time goes by, scripts will become bigger and bigger, computers will be come slower (due too unefficient operating systems), and instead of having 100 script files of 200KB each (Maybe this thing will be common in like 10-20 years), it can be easier to work with 10 scripts of 2MB each!
(those scripts are a part of a big script).


:tongue:

Joined: Aug 2003
Posts: 72
V
Babel fish
Offline
Babel fish
V
Joined: Aug 2003
Posts: 72
What you saying is non sense.

Joined: Nov 2004
Posts: 148
D
Vogon poet
OP Offline
Vogon poet
D
Joined: Nov 2004
Posts: 148
WHY???

Joined: Oct 2004
Posts: 11
C
Pikka bird
Offline
Pikka bird
C
Joined: Oct 2004
Posts: 11
Well if you were *programming* a decent or even smallish scaled application especially in C/C++ 500kb of code would be jack all.

Considering what mIRC's scripting language can do I don't see why that is too large. But for speed and memory performance reasons it may be infact better to split things up.

This of course all depends on the script code itself, you may not benefit from splitting some of your code up besides the problems you mentioned in your first post.

EDIT: Also I figured mIRC at the very least especially for Scripting would be using a RichEdit control or atleast it's own implementation of it to get around such flaws.

I suppose you don't come across invidivual script files that large though too often.

Last edited by Chesso; 18/05/06 03:31 PM.
Joined: Dec 2002
Posts: 252
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
I came across this problem once. I wrote a FULL clone to the Conference Room IRCd in mIRC. which did httpd, its own cgi format for httpd, ircd, services for ircd, link support, etc. I ended up splitting it up into like 5 or 6 seperate files because of this bug.


Link Copied to Clipboard