hadzill,
what current state are you checking?
For example below, Script checks the current state of z-buffer setting.
In this case it will either be true or false.
Then it sets (toggles) it to the opposite.
But I think you could do a If/Then, Else, EndIf
If variibale is true (or false...