mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
Posts: 48
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


A Creative & Interactive mIRC Scripting
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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)
}

Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
Posts: 48
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

Last edited by DEATHJ0KER; 16/03/13 10:26 PM.

A Creative & Interactive mIRC Scripting
Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
Posts: 48
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


A Creative & Interactive mIRC Scripting
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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

Joined: Apr 2012
Posts: 48
Ameglian cow
OP Offline
Ameglian cow
Joined: Apr 2012
Posts: 48
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


A Creative & Interactive mIRC Scripting
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Good stuff smile


Link Copied to Clipboard