mIRC Home    About    Download    Register    News    Help

Print Thread
$settings or on saveini event #83173 16/05/04 03:44 AM
Joined: Apr 2003
Posts: 36
L
LifeIsPain Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Apr 2003
Posts: 36
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.

Re: $settings or on saveini event #83174 16/05/04 04:00 AM
Joined: Aug 2003
Posts: 325
W
Wolfie Offline
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
If you're gonna do that, why not...
$settings(events,default,3) and have it do the 'gettok' for you automatically?

Re: $settings or on saveini event #83175 16/05/04 04:17 AM
Joined: Apr 2003
Posts: 36
L
LifeIsPain Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Apr 2003
Posts: 36
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]

Last edited by LifeIsPain; 16/05/04 04:31 AM.
Re: $settings or on saveini event #83176 16/05/04 04:22 AM
Joined: Aug 2003
Posts: 325
W
Wolfie Offline
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
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.

Re: $settings or on saveini event #83177 16/05/04 04:36 AM
Joined: Apr 2003
Posts: 36
L
LifeIsPain Offline OP
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Apr 2003
Posts: 36
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

Re: $settings or on saveini event #83178 16/05/04 05:28 AM
Joined: Aug 2003
Posts: 325
W
Wolfie Offline
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
Well since mIRC has to parse it anyway, it is more likely to parse it correctly.
smile