Author Topic: Toggling Swatches / Whatever visibility through the script?  (Read 769 times)

Yea, so. I'm making a GUI, and I need to know how to make Some swatches visible / not visible through the script.
All of the swatches are named, and the button's command names are stuff like B_Criminals.
This is the visual example, of what It is supposed to do, when you click on a button. But this is not functional, there is no script yet.

If you used .dump() on one of the swatches you could see that it has a setVisible(bool) method, which makes it invisible/visible.

If you used .dump() on one of the swatches you could see that it has a setVisible(bool) method, which makes it invisible/visible.
OK, but how would I put this in script? I haven't really messed with messing with components of the GUI through the script

GuiBitmapButtonCtrls have a value called command, if you're using the GUI editor you can change it on the right after selecting it. If you want to change a swatch's visibility by clicking on it change the command to like B_Criminals.setVisible(0); or whatever it is.

GuiBitmapButtonCtrls have a value called command, if you're using the GUI editor you can change it on the right after selecting it. If you want to change a swatch's visibility by clicking on it change the command to like B_Criminals.setVisible(0); or whatever it is.
Hmm, ok. So. If I have a command on a button like "B_Jobs();"
Would this work?

Code: [Select]
function b_Jobs()
{
Swatch1.setVisible(1);
Swatch2.setVisible(0);
}

This would turn "Swatch1" to be visible, and "Swatch2" to be not visible? (If I press the button, "B_Jobs();")

If you made B_Jobs call that command, yes.

If you made B_Jobs call that command, yes.
Alright, it worked. Thanks guys.
« Last Edit: August 09, 2015, 12:16:22 PM by Dragonoid.Slayer »