mIRC Homepage
Posted By: DEATHJ0KER mIRC variables set by /writeini /readini - 16/03/13 12:31 AM
I want to build a handler for the loading and saving of the themes of the script, writing variables mirc in a ini file numbering each time you save.
To do that you have completed so the code
Code:
; set the numerator to set variables in a consecutive manner
alias save_theme_number {
  set %x.ini $ini($shortfn($mircdir $+ vxd.ini),0)
  set %x.ini $ini($shortfn($mircdir $+ vxd.ini),%x.ini)
  set %x.ini $calc(%x.ini + 1)
  write_vars
}

; Carries the variables in. Ini file
alias write_vars {
  writeini " $+ $shortfn($mircdir $+ vxd.ini) $+ " %x.ini stile %stile 
  writeini " $+ $shortfn($mircdir $+ vxd.ini) $+ " %x.ini chiarox %chiarox 
}

; Reads the variables from INI files
alias load_vars {
  set %stile $readini($shortfn($mircdir $+ vxd.ini),n,%x.ini,stile)
  set %chiarox $readini($shortfn($mircdir $+ vxd.ini),n,%x.ini,chiarox)
}


Here is how advanced the number in the file. Ini
Code:
[1]
stile=verticalrev
chiarox=255

[2]
stile=grade
chiarox=200

...etc

When i read the variables loading them in mirc, configuration is loaded numbered with the number [1]
How do i upload the numbered setting i have chosen? sick
Posted By: hixxy Re: mIRC variables set by /writeini /readini - 16/03/13 07:47 PM
Change %x.ini in the /load_vars command to $1, then you use it like /load_vars <number>.

The whole thing can be simplified though:

Code:
alias -l tini { return $shortfn($mircdirvxd.ini) }
alias save_theme_number {
  set %x.ini $calc($ini($tini,$ini($tini,0)) + 1)
  write_vars
}
alias write_vars {
  writeini $tini %x.ini stile %stile
  writeini $tini %x.ini chiarox %chiarox
}
alias load_vars {
  set %stile $readini($tini,n,$1,stile)
  set %chiarox $readini($tini,n,$1,chiarox)
}
hixxy thanks, now works correctly smile
I made some attempts using a variable that drew many ini files numbered but neglected that even if I had to use the variable would have to use var %myvar $1.
It 's very fast loading of the many variables set, my curiosity about the number of rows that mirc can read an ini file. In your opinion would be better replicate ini files or safely proceed with the reading of the configurations in a single file?

thanks again
Originally Posted By: DEATHJ0KER
hixxy thanks, now works correctly smile
Code:
;=============================================================;
; menage themes | VxÐ ~ http://vxd.altervista.org/VxD.htm ~ caronte.ade@gmail.com | mIRC &#9760;  VxÐ $¢®iþ† | recoded from --> hixxy https://forums.mirc.com/ubbthreads.php/topics/241039#Post241039    ;                                                                                                                                                      ;
;=============================================================;
alias save_theme_number {
  set %x.ini $calc($ini($tini,$ini($tini,0)) + 1)
  write_vars
}

alias write_vars {
  writeini $tini %x.ini stile %stile 
  writeini $tini %x.ini chiarox %chiarox 
}

;command /load_vars "number"
alias -l tini { return $shortfn($mircdirthemes\styles\vxd.ini) }
alias load_vars {
  set %stile $readini($tini,n,$1,stile)
  set %chiarox $readini($tini,n,$1,chiarox) 
}


thanks again
Posted By: hixxy Re: mIRC variables set by /writeini /readini - 17/03/13 08:24 PM
Carry on using one file, should be fine. If it grows too massive you might want to look at alternative storage methods, but mIRC can efficiently handle files many megabytes in size smile
i have to finish the theme manager to test it fully, for now i clicked on the Save button at least 100 times and re-read the issues with alias without problems
LoL
http://www.youtube.com/watch?v=yMkCc3uSm8M&feature=player_detailpage
Posted By: hixxy Re: mIRC variables set by /writeini /readini - 17/03/13 11:32 PM
Good stuff smile
© mIRC Discussion Forums