custom properties

Jeanne A. E. DeVoto jeanne at
Fri Mar 1 03:05:01 EST 2002

At 5:15 AM -0800 2/28/2002, Steve Messimer wrote:
> I want to check a cd for the presence or absence of a custom
>property.  If the property doesn't exist then I want to create it.  The
>presence of the property will act as a flag that indicates that the object
>has already had a controlling handler added to its script.
>Would the properties placed in propCker be placed there as in an array so I
>could use a repeat structure to check for the presence of the property I'm
>looking for.

This is far more complicated than you need if all you're doing is checking
for the existence of the property. This will do it (assuming the name of
the property is "MyScriptFlag":

  if "MyScriptFlag" is not among the lines of \
     the customKeys of card "Whatever" then
    -- property doesn't exist, so create it
    set the MyScriptFlag of card "Whatever" to true
    -- the above line creates the custom property as well as setting
    -- its value
    -- do whatever you want to do with the script
  end if

Jeanne A. E. DeVoto ~ jeanne at
Runtime Revolution Limited - Power to the Developer!

More information about the use-livecode mailing list