ZBrushCentral

Code Sample: Why does this RoutineCall not happen?

Given the script:

[IButton, "Reload", "", [IPress, "Zscript:Reload"]]

[RoutineDef, AddButton,
  [VarSet, name, name_]
  [VarSet, res, res_]
  [VarSet, label, [StrMerge, name, res]]
  [VarSet, path, [StrMerge, "Tool:Initialize:", name]]
  [IButton, label, "",
    [ISet, Tool:Initialize:X Res, res]
    [IPress, path]
   ]
   , name_, res_
]

[RoutineCall, AddButton, QSphere, 4]   // This creates a button that works as expected
[RoutineCall, AddButton, QSphere, 8]   // This does nothing
                                       // though note the extra space created

Down to one question, since someone pointed out script parameters don’t act as variables:

Why is only QSphere4 created?

I really don’t know why it should work once only. But it’s not a good idea to include Button creation code inside a routine. And ZBrush doesn’t generally like the creation of buttons on the fly - it’s best to find a different way of doing what you want.