ZBrushCentral

Evaluating switches in a routine

For some reason, when I try to evaluate a set of switches inside of my routine, ZBrush gives me an “insufficient inputs” error. The code block works outside of a routine though.


    [RoutineDef, ModeCheck,
    
        [If, [IGet,"ZPlugin:BradTile:Selected"]=1,
            [VarSet, Mode, 1]
            ,
            [If, [IGet,"ZPlugin:BradTile:Visible"]=1,
                [VarSet, Mode, 2]
                ,
                [If, [IGet,"ZPlugin:BradTile:Set"]=1,
                    [VarSet, Mode, 3]
                    ,
                    [VarSet, Mode, 4]
                ]
            ]
        ]

        [VarSet, gPerfMode, #Mode]

    ]

Maybe of some use to you >>http://www.zbrushcentral.com/showthread.php?179839-Do-Nothing-in-an-IF-Statement

Are you sure that your code is exactly as you show it there? I don’t get an error when I test it. It may be that you have misplaced some code somewhere. An extra comma, that kind of thing.

Also, a note about how your code works. I noted that, for example, the ‘Visible’ switch will only be tested if the ‘Selected’ switch is off. Perhaps this is what you intend but I thought I’d mention it.

thank you Marcus,

that’s weird, I pasted that section of code straight out of my script and dont think I changed anything. I’m not at my computer yet but I’ll take another look later and let you know what happens. as far as the design goes it’s intentional, only one of thos switches can be on at any given time and controls which type of object(s) will be performed on.

Brad

I’m embarrassed to even admit that it was a simple typo as you mentioned Marcus, located in the routineCall. :rolleyes:

And I realized that I’m also under-utilizing switches, I don’t even need that routine outside of debugging because I can set the global mode variable in the switches

Brad,
My suggestion was from long experience - I make that sort of error the whole time!