Get 1Click Maker

ON/OFF Toggle Button ​

Two buttons (show hood, hide hood) are easy. One button that alternates needs the item to remember its state. That is exactly what a variable and a condition do.

We will build a button that shows and hides a jacket's hood.

You need: a jacket target with a link named hood, a HUD with a prim named hood_toggle, and [add-on] - Conditions & Variables - 1Click in the HUD.

1. Create the variable ​

  1. Click the orange tools button (bottom left) β†’ { }.

  2. Create New Variable: Type String, Name hood, Initial value ON.

  3. Confirm and close the panel.

2. The condition ​

  1. Click hood_toggle in the button list to create its function, and open it.

  2. Add Condition: Field $hood, Operator ==, Value ON. Save.

  3. On the condition's card click Success. The branch opens. Add:

    • Change Variable: $hood, Set, OFF
    • Transparency: Jacket, link hood, faces All, alpha 0.0
  4. Go back, click Failure on the condition's card. Add:

    • Change Variable: $hood, Set, ON
    • Transparency: Jacket, link hood, faces All, alpha 1.0

3. Build and test ​

Build, wear copies, click the button: the hood disappears; click again: it is back.

text
hood_toggle
└─ Condition $hood == ON
   β”œβ”€ success β†’ $hood = OFF Β· Transparency hood 0.0
   └─ failure β†’ $hood = ON Β· Transparency hood 1.0

Why the variable starts as ON ​

The hood is visible when the customer first wears the jacket, so the state must say ON. If your default is hidden, start with OFF and swap the branches.

Keep the HUD in sync ​

Add an Attach event with Transparency hood 1.0 and Change Variable $hood = ON, so a fresh attach always starts from a known state (variables also reset at every Build, but not when the customer re-attaches).

The same pattern for… ​

GoalSuccess branchFailure branch
Lamp switchPoint of Light ON, $light = ONPoint of Light OFF, $light = OFF
MusicSound Loop, $music = ONSound Stop, $music = OFF
PBR togglePBR On/Off ON, $pbr = ONPBR On/Off OFF, $pbr = OFF
Highlight activeGlow 0.2, $sel = ONGlow 0, $sel = OFF

Three or more states ​

Use an integer variable ($mode = 0) and chain conditions: $mode == 0 β†’ mode 1 actions and $mode = 1; failure branch holds $mode == 1 β†’ mode 2 and $mode = 2; its failure holds the last mode and $mode = 0.