mIRC Homepage

help or suggestions with custum settings file

Posted By: clutz1572

help or suggestions with custum settings file - 06/10/04 02:10 PM

hello again,

i'm trying to figure out how to make a settings file with /writeini in this format: [blahblah]
setting1 == on
setting2 == on
ect......
save and then read from that file and have it adjust the settings according to what settings were set to from the settings dialog. i am using checkboxes for the selections..

i've took the liberty of trying to look at examples from other scripts like sysreset and invision, but i don't want to just copy that those authors did allthough the end resulting code may look similar.... so i'm looking for either some help or suggestions on this.....

Posted By: LocutusofBorg

Re: help or suggestions with custum settings file - 06/10/04 05:08 PM

suggestion 1:
pick better scripts to learn from

suggestion 2:
open the mirc.ini file, you will see there is always the following format:

[SECTION]
item1=value
item2=value

To add to your ini file like that, simply use

/writeini filename.ini SECTION item value}

To read the value, simply use

$readini(filename.ini,SECTION,item
Posted By: clutz1572

Re: help or suggestions with custum settings file - 07/10/04 05:11 AM

lol @ your first suggestion locutus.... :tongue:

i've looked at the mirc help file again and saw that the /writeini does infact do what i was asking about... ( i hate asking lamer questions, blah) so if i had somthing like this:

Code:
dialog Ini-Test {
  title "test"
  size -1 -1 87 84
  option dbu
  box "Settings", 1, 13 8 64 67
  check "Join Messages", 2, 21 21 50 10
  check "Part Messages", 3, 21 30 50 10
  check "Quit Messages", 4, 21 39 50 10
  button "Button", 5, 24 58 37 12, ok
} 


my alias would look like this then, correct?
Code:
 walias { /writeini -n dat\ini\test.ini $1 $2 $3- } 

so my call string would be sumthing like :
Code:
 if ($did == 2) { if ($did(ini-test,$did).state == 1) { $walias visuals Join On } | else { $walias visuals Join Off } }  

for my read:
Code:
ralias { $readini(test.ini $1 $2 } 

and call string:
Code:
if ($ralias(visuals,Join) == On) { did -c $dname 2}  

would this also be correct???
Posted By: Iori

Re: help or suggestions with custum settings file - 07/10/04 10:00 PM

  • if ($did == 2) { $walias(visuals,Join,$iif($did(2).state,On,Off)) }

Although you might like to use
  • if ($did == 2) { $walias(visuals,Join,$did(2).state) }
which would make the entry 0 (Off) or 1 (On)
[visuals]
Join=0
Part=1

Then in the init you can use this simpler code.
  • if $ralias(visuals,Join) { did -c $dname 2 }
    if $ralias(visuals,Part) { did -c $dname 3 }

Code:
ralias [color:tomato]return[/color] $readini([color:red]dat\ini\[/color]test.ini,$1,$2)

Posted By: NaquadaServ

Re: help or suggestions with custum settings file - 09/10/04 07:02 AM

Oh gezz, save yourself years of headache and read up on hash tables "/help /hmake"...
Posted By: clutz1572

Re: help or suggestions with custum settings file - 10/10/04 02:53 AM

heh,


if your basing your comments on the example i gave then yes perhaps a hash table would work ok(i guess)... but theres more going on than just that........... thanks for the hint tho... wink
© 2020 mIRC Discussion Forums