Navigation

    TripleA Logo

    TripleA Forum

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

    Variable lists do not seem to work

    Map Making
    4
    14
    1360
    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.
    • Frostion
      Frostion Admin last edited by

      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

      redrum 1 Reply Last reply Reply Quote 0
      • redrum
        redrum Admin @Frostion last edited by

        @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>
        
        1 Reply Last reply Reply Quote 1
        • Frostion
          Frostion Admin last edited by

          @redrum I still get an error:
          Unavngivet.png

          The AllLandUnits and AllAirUnits are used many times in the XML so it cant be them I think.

          redrum 1 Reply Last reply Reply Quote 0
          • redrum
            redrum Admin @Frostion last edited by

            @Frostion Can you post the 3 variable lists from the XML? Or just post your XML?

            1 Reply Last reply Reply Quote 1
            • Frostion
              Frostion Admin last edited by

              world_of_war_heroes.xml

              redrum 1 Reply Last reply Reply Quote 0
              • redrum
                redrum Admin @Frostion last edited by

                @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 🙂

                Frostion 1 Reply Last reply Reply Quote 1
                • Frostion
                  Frostion Admin @redrum last edited by Frostion

                  @redrum Oh! I will make this feature request immediately! 🙂

                  https://forums.triplea-game.org/topic/1586/allow-unit-property-givesmovement-to-use-variable-lists

                  1 Reply Last reply Reply Quote 0
                  • W
                    wc_sumpton last edited by

                    @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...

                    redrum 1 Reply Last reply Reply Quote 0
                    • redrum
                      redrum Admin @wc_sumpton last edited by

                      @wc_sumpton I don't believe so. The foreach would be creating multiple separate unit attachments not multiple options in the same attachment.

                      W 1 Reply Last reply Reply Quote 0
                      • W
                        wc_sumpton @redrum last edited by

                        @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...

                        redrum 1 Reply Last reply Reply Quote 0
                        • redrum
                          redrum Admin @wc_sumpton last edited by

                          @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 🙂

                          1 Reply Last reply Reply Quote 0
                          • Martin Madueño
                            Martin Madueño last edited by

                            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.

                            error.PNG

                            		<variableList>
                            			<variable name="prueba">
                            				<element name=""/>
                            			</variable>
                            		</variableList>
                            

                            ¿Can you please tell me what I'm missing?

                            Thanks

                            redrum 1 Reply Last reply Reply Quote 0
                            • redrum
                              redrum Admin @Martin Madueño last edited by

                              @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

                              Martin Madueño 1 Reply Last reply Reply Quote 2
                              • Martin Madueño
                                Martin Madueño @redrum last edited by

                                @redrum Thanks, i will try with pre-release 😄

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