Foreach loop not working
-
I anm receiving the following error
Could not parse:file:///C:/Users/Roger/triplea/downloadedMaps/Experiment/AA50-41-Maintenance.xml, Attachment has invalid variables in foreach: $ActivePlayer$ games.strategy.engine.data.gameparser.GameParseException: Attachment has invalid variables in foreach: $ActivePlayer$
Here is the code:
<variable name="ActivePlayer"> <element name="Germans"/> <element name="Russians"/> <element name="Japanese"/> <element name="Americans"/> <element name="British"/> <element name="Italians"/> </variable>and
<attachment foreach="$ActivePlayer$" name="objectiveAttachment@ActivePlayer@_Extra_Income" attachTo="@ActivePlayer@" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="objectiveValue" value="1"/> <option name="directOwnershipTerritories" value="map" count="each"/> </attachment>I have used foreach successfully before. Does anyone see the problem>
-
I forget to wrap the variable with variableList.
-
@RogerCooper Glad i could help! :cat_face_with_tears_of_joy:
-
@RogerCooper By the way, I made a simple tool that will generate variableLists from all territories and players and put that in your game file. It's the
varscommand from the CLI here: https://forums.triplea-game.org/topic/2501/command-line-tools-for-map-making
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login