At 11:18 AM 1/29/2005 -0700, you wrote:
>Okay. that worked almost perfectly. Is there a good writeup on how the
>scripts work?
Not yet. The current docs are more of a reference manual. The "how to"
component is what needs to be written before the docs are no longer Beta
and ready for true release.
>In 2.x I understand quite well, how to modify a parent
>attribute when you add an option, but I just can't seem to figure this
>one out also. I was warned by a few people that the scripting of ab3
>was the hard part to learn....
Scripting is definitely a whole new kettle of fish for AB3. It's vastly
more powerful and flexible, plus it's actually a lot easier once you get
the hang of it. The trick is getting the hang of it.
>But in reference: I have a unit size of 1-10, and now, when I add the
>effective child, the size is completely limited to 10, when the child
>(1-5) should make the new max size 15. Help please.
Ah! From your original description, I thought you were referring to the old
V2.x "coun" attribute, which has basically been renamed the "effective"
count in AB3.
Just to make sure I understand, you have a parent unit of size 1-10. You
have a child unit of size 1-5. The size of the child unit has no impact on
the size limits for the parent unit. When the child unit is added, the
total combined unit size of parent AND child must be 6 or less for an
option to be valid. Is that right?
Assuming the above is right, here's how I do it. First, remove the
"effective" flag from the child unit, since that doesn't apply in this
situation. It could be used to easily get the combined total models of the
parent and child, but it has the additional effect of imposing the
restriction on the parent that you identified above. So we need a different
way for the child unit to be factored into the total net size of the
parent. To do that, you'll need to setup a new private unit stat for
tracking that total. Let's call the stat "netcount". The parent unit can
initialize the count to its model count within its "PreLinks" script with
the line below:
this.stat[netcount] = this.count[model]
The child unit can then add its model count to this new stat in the parent
unit via a script. For example, the "PreLinks" script for the child unit
could include the line below:
parent.stat[netcount] = parent.stat[netcount] + this.count[model]
The parent unit will now have the combined model count of itself and the
child unit in the "runtime.netcount?" tag. You can then change the "live"
tag expression on the option to something like below:
val:runtime.netcount? <= 6
The next result should be that the option is only valid when the total
combined number of models in the parent AND child unit is six or less.
Hope this helps,
Rob
---------------------------------------------------------------------------
Rob Bowes (rob@wolflair.com) (650) 588-8252
Lone Wolf Development
www.wolflair.com