Function returning unexpected type

image

I am trying to call the switch class’s GetCurrentState function which says in the documentation it returns true or false.

But when I try to set the result to a logic variable Forward, I get the error:

This assignment expects a value of type logic, but the assigned value is an incompatible value of type void.(3509)

I feel like it may have something to do with GetCurrentState being failable, and Forward being unable to accept void as a value, but I have no idea how to fix this.

Try wrapping it in an optional : option{set Forward.......}

Or use an if statement :

if(SwitchState := ForwardSwitch.GetCurrentState[]):
    set Forward = SwitchState 
else:
    Print("no state found")

It could have something to do with the <decides> specifier aswell

After trying those it gave me other errors. It turns out I needed to cast it to a logic instead.

image

You were right about <decides> though. I needed to remove that.

Thanks!

Yes, you’re right too, my bad, didn’t read the docs!