|
Joined: Apr 2012
Posts: 47
Ameglian cow
|
OP
Ameglian cow
Joined: Apr 2012
Posts: 47 |
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
; 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
[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?
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
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: 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)
}
|
|
|
|
Joined: Apr 2012
Posts: 47
Ameglian cow
|
OP
Ameglian cow
Joined: Apr 2012
Posts: 47 |
hixxy thanks, now works correctly  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
Last edited by DEATHJ0KER; 16/03/13 10:26 PM.
|
|
|
|
Joined: Apr 2012
Posts: 47
Ameglian cow
|
OP
Ameglian cow
Joined: Apr 2012
Posts: 47 |
hixxy thanks, now works correctly 
;=============================================================;
; menage themes | VxÐ ~ http://vxd.altervista.org/VxD.htm ~ caronte.ade@gmail.com | mIRC ☠ 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
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
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
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
Good stuff
|
|
|
|
|