afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [community profile] style_system 2009-11-18 02:36 am (UTC)

You can set properties to other properties on prop_init, but I'm not sure about the particular scenario you're proposing, since usually what we do is check whether $*Y has been set; if it has, we use the user-defined value. If it hasn't, we use the fallback value. So something like this:

layout:
property Color X { des = "base value" }
property Color Y { des = "falls back on base value if not provided" }
set X = "blue"
set Y = ""


function prop_init() {
    if ( $*Y == "" or not defined $*Y ) {
        # Y has no value, let's fill it in 
        $*Y = $*X
    }
}

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting