Jump to content

Recommended Posts

Posted

I set an object variable for severa; trains (Camera).  It shows in the EV with the correct value.   I read the name of a loco with $_Trigger1._Name.  I store that name in a global

variable.  Can I now read the name of the camera for that train, and tell the EV to activate that camera?

Posted (edited)

Hello Trevor,

you are quite right. Even you can avoid the parantheses here.

But the aim of the example above was to explain how different variations of global and object variables may be used to buffer and later evaluate some object properties. See here the optimized example (without "buffer variables").

Using loco object variables directly.mbp

Many greetings
BahnLand

 

Edited by BahnLand
Posted
On ‎24‎/‎09‎/‎2016 at 11:15 AM, BahnLand said:

Hello Trevor,

you are quite right. Even you can avoid the parantheses here.

But the aim of the example above was to explain how different variations of global and object variables may be used to buffer and later evaluate some object properties. See here the optimized example (without "buffer variables").

Using loco object variables directly.mbp

Many greetings
BahnLand

 

I agree. However, it is generally bad practice to use global variables if you do not have to. On a simple layout you might get away with it, but the more things you have happening the more opportunity there is for multiple objects to be referencing the same variable at the same time with unpredictable results.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...