If not, a "standard" way is to get and set property values is using accessor methods. In a behavior attached to the Mass-Spring-Damper thing:
property pMyProperty
on mGetMyProperty me return pMyProperty end
on mSetMyProperty me, newValue pMyProperty = newValue end
Then do the set or get via a sendSprite:
someVariable = sendSprite(channelOfDamper, #mGetMyProperty)
or
sendSprite(channelOfDamper, #mSetMyProperty, newValue)
You would need one such pair for each property. However, if you have a number of different properties, then you could also pass in the property name to get/set as an argument:
on mSetMyProperty me, symProperty, newValue -- I think this will work me.symProperty = newValue
-- If not, you can use a case statment for each of the properties in your script
case symProperty of
#pPropertyName1:
pPropertyName1 = newValue
#propertyName2:
pPropertyName2 = newValue
etc.
end
on mGetMyProperty me, symProperty return me.symProperty
-- Or use a case as above end
If there are multiple properties you need to set/get at once, you could package them up into a list.
Or
Irv
At 2:25 PM -0500 2/20/04, roymeo wrote:
I've got a parent script which does your standard Mass-Spring-Damper sort of boinging. I'd like to be able to pass it a sprite object and a #Property and have it automatically get/set that sprite's property.
So if I want to attach it to sprite(x).locH, I send it sprite(x) and #locH which are params oSprite and sProp
and I can address sprite(x).locH
But you can't address sprite(x).sProp or sprite(x).getProp(sProp) etc.
Is there a way to do this without using do statements?
My brain is itching in that way that means I'm either missing something obvious or due for my next trepanning session.
--
Multimedia Wrangler.
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]
