Verse API GetCurrentState[Agent] of Switch Device is broken

When using this API (GetCurrentState[Agent]) in a IF statement like “GetCurrentState[Agent] = false”
it only works when the Switch is on “ON”. “GetCurrentState[Agent] = true” doesn’t even work.

If you share your code that isn’t working I can see what the problem might be

1 Like

try this

if(Switch.GetCurrentState[Agent]):
      Print("Is True")
if(not Switch.GetCurrentState[Agent]):
      Print("Is False")
2 Likes

Wait I will send u the code, sry for the late response, didnt see it. Thanks for your response

Check(Agent:agent):void=
        if:
            Switch1.GetCurrentState[Agent] = false
        then:
            Print("False")

        else if:
            Switch1.GetCurrentState[Agent] = true
        then:
            Print("True")

# False prints only when the Switch is on ON and True doesn't even worked out, before that I used just else instead as an fail.

Okey I will try that now, thanks for your response

Big thank you, worked out. I don’t understand why I couldn’t set it equal to a logic? Do you know why?

Because it does not return a bool but rather fails the function. Hope this solves your question

1 Like

Okey thanks, you helped a lot

1 Like