ZBrushCentral

Multiple Variables Saved to File

I seem to be having issues with saving multiple variables to a file, the last variable written seems to be replacing the previous.

This is what I’m trying to do:

[VarSave, var_1, FILE_VARS]
[VarSave, var_2, FILE_VARS]

Does this method only support a single variable per file?

http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/command-reference/#Memory_Blocks

Thanks Doug, I’m using memory blocks for a handful of things already; but I was hoping that I could store off certain user settings in between zbrush sessions and present the option to load settings from a file

You’re overwriting the file with the second varable. If you want to write several variables to a single file then use a list variable:

[VarDef,listVar(6),0]

[Varset,listVar(0),52]
[VarSet,listVar(1),45]
//…etc

[VarSave,listVar,FILE_VARS]

Note the index starts at 0 for the numbered variables, so the range is 0-5 for the example above. If you want to use meaningful variable names then copy them to a list variable before saving and copy back after loading.

Thanks Marcus! Good idea about creating a routine for packing my variables into a list so that I can keep my code readable; I think I’ll do that for sure. Thanks!