Member
Volunteer Data File Author
Join Date: Apr 2005
Location: North Western Arizona
Posts: 97
|
For a unit option, I'm doing a live evaluation based on this one, to only enable the option if the count is 6 or less:
val:runtime.effect? <= 6 Problem is, I am now including a child unit that this needs to take into account. How would I write that? __________________________________________________ ______________ Sent via the WebMail system at lokilaw.com |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
You are already checking the "effective" count within your live expression
below. So all you need to do is designate the child unit as "effective". This way, its count will be included in the value used by your tag expression. If I'm understanding correctly, that should be all you need to do. If I'm NOT understanding correctly, please provide me with more details on the situation and I'll do my best to point you in the right direction. -Rob At 03:55 PM 1/27/2005 -0700, you wrote: >For a unit option, I'm doing a live evaluation based on this one, to only >enable the option if the count is 6 or less: > >val:runtime.effect? <= 6 > >Problem is, I am now including a child unit that this needs to take into >account. How would I write that? --------------------------------------------------------------------------- Rob Bowes (rob@wolflair.com) (650) 588-8252 Lone Wolf Development www.wolflair.com |
#2 |
Member
Volunteer Data File Author
Join Date: Apr 2005
Location: North Western Arizona
Posts: 97
|
That's exactly right, but the scripting files are pretty difficult to understand, how would I do that? Is it an entry on the child unit, or to tell the parent to include the child somehow?
---------- Original Message ---------------------------------- From: Rob Bowes <rob@wolflair.com> Reply-To: armybuilder@yahoogroups.com Date: Fri, 28 Jan 2005 15:03:25 -0800 > >You are already checking the "effective" count within your live expression >below. So all you need to do is designate the child unit as "effective". >This way, its count will be included in the value used by your tag expression. > >If I'm understanding correctly, that should be all you need to do. If I'm >NOT understanding correctly, please provide me with more details on the >situation and I'll do my best to point you in the right direction. > >-Rob > >At 03:55 PM 1/27/2005 -0700, you wrote: > >>For a unit option, I'm doing a live evaluation based on this one, to only >>enable the option if the count is 6 or less: >> >>val:runtime.effect? <= 6 >> >>Problem is, I am now including a child unit that this needs to take into >>account. How would I write that? > > >--------------------------------------------------------------------------- >Rob Bowes (rob@wolflair.com) (650) 588-8252 >Lone Wolf Development www.wolflair.com > > > >To unsubscribe from this group, email > >armybuilder-unsubscribe@yahoogroups.com >Yahoo! Groups Links > > > > > > > > > __________________________________________________ ______________ Sent via the WebMail system at lokilaw.com |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
Sorry, I didn't realize that's what you were asking for. Within ABCreator,
select the child unit. You'll see an area labeled "Other Details" to the right of the Description and Design text. Click on the "Edit" button beneath it. Select the "Is Effective" option from the droplist that appears, then set the "effective" state by checking the checkbox that appears. Save your changes and the unit will now be treated as "effective". -Rob At 04:04 PM 1/28/2005 -0700, you wrote: >That's exactly right, but the scripting files are pretty difficult to >understand, how would I do that? Is it an entry on the child unit, or to >tell the parent to include the child somehow? > > >---------- Original Message ---------------------------------- >From: Rob Bowes <rob@wolflair.com> >Reply-To: armybuilder@yahoogroups.com >Date: Fri, 28 Jan 2005 15:03:25 -0800 > > > > >You are already checking the "effective" count within your live expression > >below. So all you need to do is designate the child unit as "effective". > >This way, its count will be included in the value used by your tag > expression. > > > >If I'm understanding correctly, that should be all you need to do. If I'm > >NOT understanding correctly, please provide me with more details on the > >situation and I'll do my best to point you in the right direction. > > > >-Rob > > > >At 03:55 PM 1/27/2005 -0700, you wrote: > > > >>For a unit option, I'm doing a live evaluation based on this one, to only > >>enable the option if the count is 6 or less: > >> > >>val:runtime.effect? <= 6 > >> > >>Problem is, I am now including a child unit that this needs to take into > >>account. How would I write that? --------------------------------------------------------------------------- Rob Bowes (rob@wolflair.com) (650) 588-8252 Lone Wolf Development www.wolflair.com |
#4 |
Member
Volunteer Data File Author
Join Date: Apr 2005
Location: North Western Arizona
Posts: 97
|
Okay. that worked almost perfectly. Is there a good writeup on how the
scripts work? 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.... 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. Rob Bowes wrote: >Sorry, I didn't realize that's what you were asking for. Within ABCreator, >select the child unit. You'll see an area labeled "Other Details" to the >right of the Description and Design text. Click on the "Edit" button >beneath it. Select the "Is Effective" option from the droplist that >appears, then set the "effective" state by checking the checkbox that >appears. Save your changes and the unit will now be treated as "effective". > >-Rob > > > |
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
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 |
#6 |
Member
Volunteer Data File Author
Join Date: Apr 2005
Location: North Western Arizona
Posts: 97
|
Actually, that worked perfect. Sort of. I had two issues implementing
this. I kept getting syntax errors in my live script. It wasn't until I changed from btsqdcount to btSquad that it went away, perhaps there is a size restriction on the variable name length? Also, it wouldn't add correctly when I used 'this.xxx' but when I got a pointer from another author I changed it to 'entity.xxx' and it works perfect now. Rob Bowes wrote: >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 > > |
#7 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
The maximum length for any tag id is 10 characters. If you have a unit
stat, the id will also include the actual value of the stat. So if you have a tag id of "btsqdcount", there is no room to append the stat value to the runtime tag id, resulting in the value being dropped off the end. And to request the value for this tag, the syntax would be "runtime.btsqdcount?", which uses a tag id of 11 characters and is invalid. That would be the cause of the compile error. You'll find additional information about how stats are managed as runtime ids in the Pre-Defined Tag Groups section of the Concepts chapter in the docs. The reference "this" indicates use of the current context of the script or tag expression. If the current context is an option, then "this" tells AB to use the option, which would not give you what you want. From an option context, you need to specify that you want the context of the containing entity, so that's why you had to use "entity.xxx" instead of "this.xxx". Hope this helps, Rob At 11:24 AM 1/30/2005 -0700, you wrote: >Actually, that worked perfect. Sort of. I had two issues implementing >this. I kept getting syntax errors in my live script. It wasn't until >I changed from btsqdcount to btSquad that it went away, perhaps there is >a size restriction on the variable name length? > >Also, it wouldn't add correctly when I used 'this.xxx' but when I got a >pointer from another author I changed it to 'entity.xxx' and it works >perfect now. --------------------------------------------------------------------------- Rob Bowes (rob@wolflair.com) (650) 588-8252 Lone Wolf Development www.wolflair.com |
#8 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
yet another script unit question [fixed] | Taubay | Army Builder | 2 | June 5th, 2008 08:28 AM |
tricky script question [fixed] | Taubay | Army Builder | 2 | June 1st, 2008 12:29 PM |
Validation rule script | esoiset at sbcglobal.net | Army Builder | 8 | March 7th, 2005 10:24 AM |
Validation script not working. | Warmonger | Army Builder | 3 | February 17th, 2005 12:31 PM |
validation question | woodywalton at hotmail.co | Army Builder | 6 | August 23rd, 2001 01:15 AM |