Home Technical Talk

MEL, how do I create toggle that changes the variable value after running once.

polycount sponsor
Offline / Send Message
malcolm polycount sponsor
I'm looking to click a button and run a bunch of lines of code and at the end update my variable so when I click the button the second time it runs some different lines of code. I tried this, but it's complaining about redeclaring the variable. What's the cleanest way to do a simple toggle where the state changes each time you run it?

int $uvToggleChecker = 1;
if ($uvToggleChecker == 1)
print "UV checker map turned on.";

if ($uvToggleChecker == 0)
print "UV checker map turned off.";
int $uvToggleChecker = 0;

Replies

Sign In or Register to comment.