Variable lists do not seem to work
-
I am working on my XML and stumbled into this problem. Is deliberate that this works:
<attachment name="unitAttachment" attachTo="Frost-Trap" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isInfrastructure" value="true"/> <option name="givesMovement" value="-1:Footmen"/> <option name="givesMovement" value="-1:Cavalry"/> <option name="destroyedWhenCapturedBy" value="Gnomes"/> </attachment>
But this does not work and will not let my load the XML: (and yes I made the variable list)
<attachment name="unitAttachment" attachTo="Frost-Trap" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isInfrastructure" value="true"/> <option name="givesMovement" value="-1:$AllLandUnits$"/> <option name="givesMovement" value="-1:$AllAirUnits$"/> <option name="destroyedWhenCapturedFrom" value="@AllPlayers@"/> </attachment>
If this is supposed to not work, I will have to make Looong value lists in this unit attackment Or am I doing something else wrong?
BTW: I use very latest pre-release -
@Frostion At a glance, you need to use "$" not "@" if you want the whole list of players so like this:
<attachment name="unitAttachment" attachTo="Frost-Trap" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isInfrastructure" value="true"/> <option name="givesMovement" value="-1:$AllLandUnits$"/> <option name="givesMovement" value="-1:$AllAirUnits$"/> <option name="destroyedWhenCapturedFrom" value="$AllPlayers$"/> </attachment>
-
@redrum I still get an error:
The AllLandUnits and AllAirUnits are used many times in the XML so it cant be them I think.
-
@Frostion Can you post the 3 variable lists from the XML? Or just post your XML?
-
-
@Frostion Oh the problem is the
givesMovement
doesn't allow a list of units. So you can't have this:<option name="givesMovement" value="-1:unit1:unit2:unit3"/>
You have to do this:
<option name="givesMovement" value="-1:unit1"/> <option name="givesMovement" value="-1:unit2"/> <option name="givesMovement" value="-1:unit3"/>
So you can't use the variable list for those currently. Would be a good feature request to allow a list of units in a single line so the first example above would work
-
@redrum Oh! I will make this feature request immediately!
https://forums.triplea-game.org/topic/1586/allow-unit-property-givesmovement-to-use-variable-lists
-
@redrum, @Frostion
Isn't 'givesMovement' an array list, and needs '-reset-'? So would something like this work:<attachment foreach="$AllLandUnits$^$AllAirUnits$" name="unitAttachment" attachTo="Frost-Trap" javaClass="games.strategy.triplea.attachments.UnitAttachment" type="unitType"> <option name="isInfrastructure" value="true"/> <option name="givesMovement" value="-1:@AllLandUnits@"/> <option name="givesMovement" value="-1:@AllAirUnits@"/> <option name="destroyedWhenCapturedFrom" value="$AllPlayers$"/> </attachment>
Cheers...
-
@wc_sumpton I don't believe so. The foreach would be creating multiple separate unit attachments not multiple options in the same attachment.
-
@redrum Yea caught that after I'd posted it (Watching American football). I believe that with a trigger this same thing could be achieved.
Cheers...
-
@wc_sumpton Yeah, I think you could do it with variable list + a trigger using it to essentially generate triggers to add to the unit attachment givesMovement list. But that is kind of messy for defining the unit attachment that isn't changing so decided it was worth updating the property to allow a list of unit types
-
Hello,
I'm new creating maps, but i just finished one
Im trying to use variables to clean the code but i'm receaving this message when i try. It's in spanish, but i think its quite clear.
<variableList> <variable name="prueba"> <element name=""/> </variable> </variableList>
¿Can you please tell me what I'm missing?
Thanks
-
@Martin-Madueño What version of TripleA are you using? Variables haven't been added into the stable release yet (1.9.0.0.13066) so you need to use the pre-release which can be downloaded here: https://github.com/triplea-game/triplea/releases
-
@redrum Thanks, i will try with pre-release