Jump to content
Oliver Hope

How do use local variables

Recommended Posts

Local variables run within the specific script at that specific moment.

IIRC, if you have a time trigger, triggering multiple times, each local variable will be "unique"

If you want a more permenant solution, create a local variable inside a global storage. This will allow you to access it from other scripts.

Share this post


Link to post
Share on other sites

Hi,

do you have any example what does not work for you? First please just post screenshot of your script and write your expectation vs what really happens.

Share this post


Link to post
Share on other sites
7 hours ago, Houp said:

Hi,

do you have any example what does not work for you? First please just post screenshot of your script and write your expectation vs what really happens.

My appologies i experienced a bug the first time i tried to use it and so i got quite confused i shall make a bug report if i encounter it again

 

Share this post


Link to post
Share on other sites

ok, please write when you encounter a problem. We are not aware of any problems with local variables and we use them in our games.

There are 4 types of variables:

Local variables, Member variables, Member variables of global storages, Member variables of entity storages

Local variables

They exist only temporarily. You can use their set/get methods only in a scope where they are defined after their definition. The new ones are created each time same piece of code is executed. (local variable are also Item in For each tile or all Event's arguments)

Member variables

They are bound to specific entity or game logic. They are "global" for whole entity or game logic. You define them for an object and then you can use them in whole entity/game logic script. (in any number of events) Their value persist through several calls of the same event/instruction. They are saved to a save file.

Member variables of global storages

For them applies same things as for a Member variables. The only difference is that you are able to get/set their values from any entity/game logic script

Member variables of entity storages

Variables defined in entity storages does not allocate any data until the entity storage is assigned to a specific entity. After that that entity have all variables defined in entity storage and you can access them from any entity/game logic script.

 

.. hopefully this helps a little.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×