Storing variables in functions

I’m trying to store variables in my functions to make it easier to correspond with events in the main events sheet.
When I add variables to objects in the function window’s variables editor I want them stored so I don’t have to keep checking I’m typing them correctly
However every time I declare the variable in the editor and go back to writing the event the variables are gone.

Screenshot 2024-09-13 112322

I appreciate this might be a limitation I’m not aware of or maybe I’m missing something completely in function creation. The educational info on functions is scant.
Thanks for any help.

Scott

It’s been like that for a while. Changes don’t last. It seems like a bug to me. If they don’t want you to be able to declare an object variable in a function then that screen shouldn’t be an option.

I think there is a request to be able to declare object variable. You could either comment on that post or create your own if it doesn’t exist.

It would be a nice feature but at the same time functions are supposed to be self-contained.

I think they would prefer that values be passed as a parameter and then returned using an expression.

Set object variable to expressionName(parameters)

I think they would also prefer people use behaviors with properties instead of relying on object variables.

Hi Keith,
Thanks for your prompt feedback. I’ll look into using the system you mentioned but agree there shouldn’t be prompts to declare variables if they can’t be stored sensibly.
It does feel like functions’ variables aren’t in sync with the main events system as you need to declare type in functions but shouldn’t declare type with the new variables in regular events.

Appreciate the clarification.

Thanks

Scott

1 Like