mIRC Homepage
Posted By: LifeIsPain $settings or on saveini event - 16/05/04 03:44 AM
I am proposing that we have easy access to all of the mirc.ini settings. Currently, to get the settings for if the quit message should be shown in the channel, you must do the following:
Code:
if ($gettok($readini($mircini,events,default),3,44) == 0)

Instead, in order to not have disk reads (which you would get a lot of in a split) if the above could be simplified to the following, you wouldn't need to do the $readini on every quit (or join, in those cases)
Code:
if ($gettok($settings(events,default),3,44) == 0)

Basically, a way for $settings(,) (or something similar) to be equivalent (other than disk reads) to $readini($mircini,,)

If this were not possible, then I could script around it fairly easily with an on SAVEINI remote event. This would be triggered any time a specified ini file were modified, possibly using the following form:
Code:
on *:SAVEINI:filename: {}

This way, one could check to see when the ini file was updated, and could (for instance) reload the contents into a hash. For my own uses, I will periodically reload the events portion of mirc.ini into my hash table, but it would be nice to actually know when it is changed, or to have direct access to this information.
Posted By: Wolfie Re: $settings or on saveini event - 16/05/04 04:00 AM
If you're gonna do that, why not...
$settings(events,default,3) and have it do the 'gettok' for you automatically?
Posted By: LifeIsPain Re: $settings or on saveini event - 16/05/04 04:17 AM
Well, I like this idea as well, but not all lines are formated the same, take for instance the default extensions settings:
Code:
[extensions]
n0=defaultEXTDIR:download\
n1=*.wav,*.mid,*.mp3,*.wma,*.oggEXTDIR:sounds\

In this case, $settings(extensions,n1,5) would return "*.oggEXTDIR:sounds\" and this isn't all that right. Instead, I was going to let the scripter figure out how each entry was to be formated.

But this does bring to mind two more things that would be nice:
  • $settings(section).0 would return the number of entries for that section, and
  • $settings(section).x would return the name of the xth entry for said section, where x is an integer from 1 to the value of $settings(section,0)



[edited notes]I know this was already replied to, but changing a bit, the first second idea was previously $settings(section,0) but I wanted to change the records[/edited notes]
Posted By: Wolfie Re: $settings or on saveini event - 16/05/04 04:22 AM
But if a $settings identifier does that much, may as well have it do the work of parsing out the data for you into usable form. And it's not a good idea to use prop's as changing values - if you want to make a script to do it, then you have to do the added work of attaching the value as a property, instead of just putting it as a parameter.
Posted By: LifeIsPain Re: $settings or on saveini event - 16/05/04 04:36 AM
Fair enough, I do like the idea of the new setting doing as much as possible. In this case, if mIRC would assign everything it knows about (as in default formats) to a property, that would be awsome, and then people who add their own sections to mirc.ini wouldn't have $settings tokenise their value (as it wouldn't know if the , was actually suppose to be a delimiter, or part of a string) then that would be great.

But to allow $settings to do everything it can (without being too bloaty) is great, thanks for the input
Posted By: Wolfie Re: $settings or on saveini event - 16/05/04 05:28 AM
Well since mIRC has to parse it anyway, it is more likely to parse it correctly.
smile
© mIRC Discussion Forums