Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Army Builder Forums > Army Builder

Notices

Reply
 
Thread Tools Display Modes
Harkan_again
Senior Member
 
Join Date: May 2012
Posts: 206

Old December 8th, 2012, 07:48 AM
Hi there

I'm trying to set a procedure up that is passed a tag name in the string format which then tags the target (in this case unit.children).

Running tests on it it works fine with the following:

var tagRet as number
tagRet = unit.assignstr("xxxxx.xxxx")

As soon as I change it to:

var tagRet as number
tagRet = unit.children.assignstr("xxxxx.xxxx")

I get an "Unexpected exception thrown during script evaluation" message. The file compiles with no issues and it is only when the procedure runs this is created.

The scenario is for a Division unit that can be assigned different nationalities, each of these affects the units that can be taken and the options each unit has. Being able to use a procedure where the tag name is passed as a string would mean one procedure rather than lots of repeated lines of code that tag and change the unit name

*edit* The format of set up within AB is the Division is a unit, it then has options that set the nationality. This script is being called from these options and is acting to change the name of the division, and tag child units of the division. Child units are controlled by live tags for each nationality, the units then have various options controlled by live tags for nationality

Any ideas with the exception thing or does assignstr not work to a unit.children level? I checked the authoring kit pdf and it does not mention assignstr

thanks

Last edited by Harkan_again; December 8th, 2012 at 07:54 AM.
Harkan_again is offline   #1 Reply With Quote
Colen
Senior Member
Lone Wolf Staff
 
Join Date: Dec 2008
Posts: 4,728

Old December 18th, 2012, 01:36 PM
Hi Harkan,

Sorry for the late reply on this. I took a look into the code, and it appears that the "str" versions of the tag targets weren't implemented on the "children" transition, even though they're documented and it compiles properly - this is a bug in Army Builder that I'll log for fixing.

There are often better ways of doing things than using the "str" versions of tag targets. Instead of using a string, could you do something like:

Code:
if (tagis[nationality.nat1] <> 0) then
  perform unit.children.assign[nattags.nat1]
elseif (tagis[nationality.nat2] <> 0) then
  perform unit.children.assign[nattags.nat2]
(etc etc)
in your procedure?
Colen is offline   #2 Reply With Quote
Harkan_again
Senior Member
 
Join Date: May 2012
Posts: 206

Old December 18th, 2012, 01:47 PM
That's the way I ended up going with it, was just hoping I could end up using a procedure passed a string to deal with it to create less lines of code as there are a lot of nationalities that the division can be

cheers as always
Harkan_again is offline   #3 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:07 AM.


Powered by vBulletin® - Copyright ©2000 - 2019, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.