ZBrushCentral

if statements and opening palettes...

hey again…
geez, really feels like i’m waering out this help thing but i’m really stuck and have had a fair crack at trying to get this thing right :frowning:

I'm trying to use "ctrl + 0" to open the alpha pallete if its not already open, and if it is to close it and re-open it. I've tried using an if statement for this but its just not having the results i expect...

the script:

[IButton,“Zplugin:More Plugs:alpha”,“alpha”,
[ISet,Zscript:Show Actions,0]
[IF, 28700 = 0, [IKeyPress,1121]
,
[ISet, 28700, 0][IKeyPress,1121]
]

,CTRL + ‘0’]

… many thanks for any help :slight_smile:

You don’t really need to find out the state of the palette (and I don’t think you can anyway but I’ve not looked that hard). The reason is that the hotkey will open or close the palette in the left tray depending on whether it’s there or not. What you might want to do is close the divider though so there’s the [IClick command to do that:

[IButton,Alphas,,
[IClick,1000]// clicks the divider handle
[IKeyPress,1121]//opens/closes Alpha palette
,,,CTRL+'0'
]

EDIT: Note when using the Modifier keys (Ctrl etc.) in hotkeys you need to release the key between repeated keypresses. Simply releasing the ordinary key (the ‘0’ in this case) is not enough.

I think I can follow where ur going with that but unfortunatly to either throw the palette onto the opposite divider from its default, or when both dividers are triggered gets caught up in either one being off while the other is on or vice versa…

I think if i was to set a closed value to the alpha palette (regardless of whether it is closed or open) and then trigger the IKeyPress I think it would have the result I’m looking for…

 [IButton,Alphas,, 
[ISet, 28700, 0]
[IKeyPress,1121]//opens/closes Alpha palette
,,,CTRL+'0']

… however, this doesn’t seem to be setting a closed value to the palette :confused:
Am i using the ISet in the correct manner?

I’ve also tried the IClose and IMinimise but each of these crashs zBrush

I can get the alpha palette to close properly with IHide but it doen’t seem to want to open again

 
[IButton,Alphas,,
 [IHide, 28700, 0]
 [IKeyPress,1121]//opens/closes Alpha palette
 ,,,CTRL+'0']

do I need to create a pause or something inbetween the IHide and IKeyPress?

If you use [IHide then you need to use [IShow to show the interface item again.
Using [ISet is only useful for those items that have different values when you use the [IGet command. Use a Note to test the thing that interests you and find out whether the command will be useful. If the item is already at 0 then using [ISet to set it to 0 will have no effect.

The solution I gave you was an example of what can be done. It wasn’t meant as a cover-all-eventualities solution. If you’re going to get your script working how you want then you’ll have to set up tests to find the state of the interface and then go on from there. Test out the various options to see what works best. It’s quite a lot of work but in the end it’s the only way you’ll produce anything useful. The bonus is you’ll learn a lot and won’t need to ask so many questions! :wink:

alot of testing it is! feeling abit dizzy after a day long close-delete-save-open-run loop :confused:

all ur help really is appriciated, I’d still have days worth of testing if it wasn’t for ur help, so a big thanks :):):+1: