Harkan_again
Well-known member
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
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: