1. #1
    Senior Member Follow User Gallery
    Join Date
    Jul 2014
    Posts
    111

    Question Get LazyMouse status

    Hi,
    This is a relatively simple idea, but I'm still having problems with ZBrush syntax.
    For those with a colourful imagination consider not so much a learning curve, but I feel like a little bee trying to headbutt his way through the glass gates to the wonderful castle of ZScript. You know, before the battering ram arrives.

    Right, simple premise. On button click:
    • find out LazyMouse status
    • change LazyMouse status
    • report LazyMouse status as either "off" or "on"
    • scrap that last line for either on/off image


    Here's what I have so far:

    // ZSCRIPT 4.73
    [IButton, "Lazy Mouse", "Get Lazy Mouse Status",

    [IConfig,4.73]

    [VarDef, s, ""]
    [VarDef, lmBool, False]

    // define stuff
    [IPress,Stroke:LazyMouse]
    // get LazyMouse status ?? No idead how to do that
    // set lmBool to LazyMouse status
    // s = (lmBool == True) ? "on" : "off"
    // if only ZScript had ternary operators!
    // Set a note
    [VarSet, s, [StrMerge, "Lazy Mouse: ", s]]
    [Note, s,,1]
    // set image - let's try that later, shall we?

    ]// End of ZScript


    Just going out on a limb here, but does ZScript have ternary operators??

  2. #2
    Moderator Follow User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    11,462

    Default

    You can query the state of a switch by using IGet:

    [VarDef,lazyState,""]
    [If,[IGet,Stroke:Lazy Mouse],
    [VarSet,lazyState,"ON"]
    ,//else
    [VarSet,lazyState,"OFF"]
    ]
    [Note,[StrMerge, "Lazy Mouse: ", lazyState]]


    ZScript doesn't have ternary operators. You have to use [If] instead. And variables can only be declared as strings or floats/integers, not bool. But you can use 1/0 instead of true/false, as I've done above.

    HTH,

  3. #3
    Senior Member Follow User Gallery
    Join Date
    Jul 2014
    Posts
    111

    Default

    As always Marcus, thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •