mIRC Home    About    Download    Register    News    Help

Print Thread
#216599 21/11/09 03:46 PM
Joined: Nov 2009
Posts: 2
K
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Nov 2009
Posts: 2
The <item> option when using writeini should be optional, and when doing so mirc automatically should add n0 n1 etc like in servers.ini. Often I don't want a specific item name.

All the nN should also be sorted automatically when removing and adding items.

The readini must also be modified to get this working. Readini shuld be able to incrementally read items inside a section and work in conjunction with loops. That way you can loop to a specific item you want to delete for example. There is probably a better way to do this. Anyway, it should be able to locate values without their specific itemname.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
You seem to misunderstand how and in which case a ini file is useful/needed
Quote:
Often I don't want a specific item name
This mean you don't need to store data related together, and that's why you should not use a ini file in this case.
Also, you can make a simple $calc in order to know the item name (n0, n1, etc).

Quote:
All the nN should also be sorted automatically when removing and adding items.
This will break a lot of script, and again, ini file isn't designed to be sorted.

If you want to sort data, use another method of storing, or made your own method to automatically sort ini file


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Why would you locate a value without a specific item name? There's no way for mIRC to know what item you're referring to if you don't tell it..

This isn't even an INI specific issue.. Even when you tell mIRC which token you want from a string via $gettok you have to give it an index. Similarly, when you $read lines from a file in order, you also have to provide line numbers. Otherwise, again, there's no way for mIRC to know.

You might want to use /fopen and $fread, which are stateful file handling operations. $fread does not require specifying a line number for this reason. $readini/$read will never behave this way. /writeini doesn't need to, either, since $readini will not.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Nov 2009
Posts: 2
K
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Nov 2009
Posts: 2
It is just that I have seen servers.ini and also mirc.ini organized this way. I wanted the same kind of thing.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
You can get the same thing... simply name your items. There's no magic involved in the way mIRC does it internally, the keys are named manually just as you would be expected to do to achieve the same result. More importantly, however, if you don't care about the key names, you probably shouldn't be using ini files.

Note that if you *really* want to iterate through an ini file without the key names, see /help $ini, because it can do that. That would be for reading, not writing, of course.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jul 2008
Posts: 236
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Jul 2008
Posts: 236
Just because mIRC does it doesn't mean it's a good idea. mIRC has code that dates back to 1996 or something. It'd be a good idea to look at how mIRC's servers.ini would be stored these days, and attempt to mimic that (pretty easy, really) because alot of advances have been made in the years.

I thought I'd never end up saying that.


Link Copied to Clipboard