ZBrushCentral

Zplugin reset after using of Other Macro or Zscript

Helllo guys ,

i have a issue with Zscript , For example i have a plugin that have ISwitch , If i turn on the switch and tneh i start some other MAcro or Plugin it reset entire my current plugin unpress all switches reset all my VarDef values and etc …

Is there a way to i fix this ?

Thank you

Your new script kills your old script. All the values are reset, it is a known limitation of Zscript.

1 Like

Hello TPQZ_DRAW

Thank you for your answer , But it is interesting how Zbrush included plugins work then … They are also external plugins . But if you use it with other Macros or Plugins they are not reset

nevermid …

Yes, interesting indeed.

I observed the same comportment you were initially describing in several of my plugins., re- initialization of the plugin.

One solution i didn’t had time to implement is storing the values as memblocks and not VarDef. Memblocks are not changing when the script change.

1 Like

Yes i didi the same , but i wanted to know if there is a easy way

Hello TPQZ_DRAW

Do you know if there is a way to save strings “names” values in one memoryblock ?

for vlues it work like this:

[MVarDef,memblock,1024,0]
//
[MVarSet,memblock,1, 11]
[MVarSet,memblock,2, 222]
[MVarSet,memblock,3, 333]
//
//
//
//
But for strings “names” it not work …Like this :
for example:

[MVarDef,memblock,1024,0]
//
[MVarSet,memblock,1, “Hello”]
[MVarSet,memblock,2, “Bye”]
[MVarSet,memblock,3, “Zvrush”]
//

Thank you

To save and read strings use :

[MemWriteString, Mem block identifier, The string, Offset (in bytes) into memory block, Write terminating zero char (if omitted:yes)]
[MemReadString, Mem block identifier, The string variable, Offset (in bytes) into memory block, Break at line end? (default:no), Skip white space? (default:no), Max read length 1 - 255(default)]

1 Like

Thank you for the help TPQZ_DRAW, i made some example and it works

//create mvardef
[MVarDef,myTempData,1024,0]

//Set string names
[VarSet, name1, “John”]
[VarSet, name2, “Stan”]
[VarSet, name3, “Lion”]

//Write it on memblock
[MemWriteString, myTempData, name1, 0]
[MemWriteString, myTempData, name2, 5]
[MemWriteString, myTempData, name3, 10]

//Reset string names
[VarSet, name1, “”]
[VarSet, name2, “”]
[VarSet, name3, “”]

//Read it to strings
[MemReadString, myTempData, name1, 0 ]
[MemReadString, myTempData, name2, 5 ]
[MemReadString, myTempData, name3, 10 ]

//Note the readed strings
[Note, name1,]
[Note, name2,]
[Note, name3,]

1 Like