Concise Variables

Scott Rossi scott at tactilemedia.com
Sun Feb 6 05:31:43 EST 2005


I'm looking for a way to employ concise persistent variable names in a
script.

Currently, I'm using the form:

  get the hilite of buttonPlay

...where buttonPlay is a script local variable containing the absolute
reference to a control.  The problem is, as soon as I edit the script, the
value of buttonPlay is lost.  I have about 15 of these references to manage.

If I change the variables to globals, the values will be persistent, but
I'll have to declare the global names everywhere in the script, which is
going to be a major chore in a 1700+ line script that has around 70
handlers, not all of which require the globals.

If I change the variables to custom properties, I'll have to use a form
similar to:

  get the hilite of (the buttonPlay of me)

Having to include the owner of the property makes for a fair amount of extra
script and complicates the readability of the script in places, compared to
the simple "buttonPlay".

So, my question is, might there be some way I can make my short object
references persistent, or must I use a more verbose form to do this?

I've considered turning the variables into functions, like buttonPlay(), but
it seems inefficient to have continually rebuild an object reference that
could be defined once and stored.  But then I'm back to the original
problem...

It's late here and I'm out of ideas so I'm looking for suggestions on how I
might solve this dilemma.

Thanks & Regards,

Scott Rossi
Creative Director
Tactile Media, Development & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the Use-livecode mailing list