Skip to content

On/Off button #1

@StarWolff

Description

@StarWolff

This is for a button on a dialog menu

If you click the button, the dialog should show the opposite button (i.e., if State_Holo=FALSE, it should display the "on" button, and set State_Holo to TRUE, and if you click that button, dialog should display the "off" button, and set State_Holo to FALSE, and clicking the off button should again show the "on" button with State_Holo set to TRUE, etc)

I have tried these 3 versions of this code. Each version gives the same result:
The button does not change until you close the menu and touch the object again - then you'll see the changed button

// version 1:

integer State_Holo = FALSE;
...
if (State_Holo == FALSE)
{
button=["on"];
State_Holo = TRUE;
}
else if (State_Holo == TRUE)
{
button=["off"];
State_Holo = FALSE;
}

// version 2:

integer State_Holo = FALSE;
...
if (State_Holo == FALSE)
{
button=["on"];
State_Holo = TRUE;
}
else if (State_Holo == !State_Holo)
{
button=["off"];
State_Holo = FALSE;
}

// version 3:

integer State_Holo = FALSE;
...
if (State_Holo)
{
button=["on"];
State_Holo = TRUE;
}
else
{
button=["off"];
State_Holo = FALSE;
}

........

llDialog(toucher,caption,button,dialog_channel);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions