Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    Foreach loop not working

    Map Making
    3
    4
    120
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      RogerCooper last edited by

      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>

      djabwana 1 Reply Last reply Reply Quote 0
      • R
        RogerCooper last edited by

        I forget to wrap the variable with variableList.

        F 1 Reply Last reply Reply Quote 2
        • F
          ff03k64 @RogerCooper last edited by

          @RogerCooper Glad i could help! 😹

          1 Reply Last reply Reply Quote 0
          • djabwana
            djabwana @RogerCooper last edited by

            @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 vars command from the CLI here: https://forums.triplea-game.org/topic/2501/command-line-tools-for-map-making

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums