TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    Variable lists do not seem to work

    Scheduled Pinned Locked Moved Map Making
    14 Posts 4 Posters 2.5k Views 4 Watching
    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.
    • redrumR Offline
      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>
      

      TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

      1 Reply Last reply Reply Quote 1
      • FrostionF Offline
        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.

        Map maker of: Star Wars: Galactic War + Star Wars: Tatooine War + Caribbean Trade War + Dragon War + Age of Tribes + Star Trek: Dilithium War + Iron War + Iron War: Europe + Warcraft: War Heroes

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

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

          TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

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

            world_of_war_heroes.xml

            Map maker of: Star Wars: Galactic War + Star Wars: Tatooine War + Caribbean Trade War + Dragon War + Age of Tribes + Star Trek: Dilithium War + Iron War + Iron War: Europe + Warcraft: War Heroes

            redrumR 1 Reply Last reply Reply Quote 0
            • redrumR Offline
              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 🙂

              TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

              FrostionF 1 Reply Last reply Reply Quote 1
              • FrostionF Offline
                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

                Map maker of: Star Wars: Galactic War + Star Wars: Tatooine War + Caribbean Trade War + Dragon War + Age of Tribes + Star Trek: Dilithium War + Iron War + Iron War: Europe + Warcraft: War Heroes

                1 Reply Last reply Reply Quote 0
                • wc_sumptonW Online
                  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...

                  redrumR 1 Reply Last reply Reply Quote 0
                  • redrumR Offline
                    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.

                    TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                    wc_sumptonW 1 Reply Last reply Reply Quote 0
                    • wc_sumptonW Online
                      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...

                      redrumR 1 Reply Last reply Reply Quote 0
                      • redrumR Offline
                        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 🙂

                        TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                        1 Reply Last reply Reply Quote 0
                        • Martin MadueñoM Offline
                          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

                          redrumR 1 Reply Last reply Reply Quote 0
                          • redrumR Offline
                            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

                            TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

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

                              @redrum Thanks, i will try with pre-release :grinning_face_with_smiling_eyes:

                              1 Reply Last reply Reply Quote 1

                              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
                              • 1 / 1
                              • First post
                                Last post
                              Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums