ZBrushCentral

ZScript Window button path

I am trying to IGetStatus of a ISwitch in the Zscript window. I feel stupid but is their a path for buttons in the script window?

I have ran into this before. I really hate creating a sub-palette just to check if something is enabled or disabled…

You can do it two ways. You can use “zscript:” for the path, adding the switch name. Or you can use the numerical position relative to the button you are using, so one place to the left is -1, one place to the right is 1, etc.

[ISwitch,"Left",0,"Popup info Text",,,,]

[IButton,"Get States from paths","Get switch states",
[Note,[StrMerge,"Left state is ",[IGet,"zscript:Left"]," Right state is ",[IGet,"zscript:Right"]],,2]
]

[IButton,"Get States from relative position","Get switch states",
[Note,[StrMerge,"Left state is ",[IGet,-2]," Right state is ",[IGet,1]],,2]
]

[ISwitch,"Right",0,"Popup info Text",,,,]

Note - I’ve used [IGet] in my example to test if the switch is pressed/unpressed as it is a simpler way to demonstrate the code. [IGetStatus] will show whether the switch is enabled or not just as well.

Fantastic! I never knew about the relative positions! Thanks so much Marcus. Once again you always have the answer I am looking for :slight_smile: I just assumed the path “Zscript:” was for the toolbar menu only.

Will the relative position way work in other menus too?

If I remember correctly, the relative position way will work in plugin menus, though I don’t use it as I often move stuff around when I’m writing a plugin. It’s also easier to read and manage the code if the paths are there.

Cheers,

Ah interesting. Yea I agree it would be easier to manage with the paths. I was just curious.

Thanks again.