Problem with TriggerAttachment using placement option



  • I am receiving the error "Unexpected error while setting values for attachment..." The error disappears when I remove the placement option. The values reference are valid "<player name="Americans" optional="false"/>" & "<unit name="airfield"/>". What am I doing wrong?

    <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="trigger" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
          <option name="when" value="after:americansPlace"/>
          <option name="placement" value="Americans:airfield"/>
    </attachment>
    
    

  • Admin

    @RogerCooper can you post the error message?



  • games.strategy.engine.data.GameParseException: map name: 'file:/C:/Users/Roger/triplea/downloadedMaps/Guadacanal/games/Guadacanal.xml', game name: 'Guadacanal', Unexpected Exception while setting values for attachment: TriggerAttachment attached to: PlayerId named:Americans with name: triggerAttachmentAmericansBuildAirfieldAtGuadacanal


  • Admin

    @RogerCooper any additional details? Otherwise I'd need to see the XML file.


  • Moderators Admin

    @RogerCooper said in Problem with TriggerAttachment using placement option:

    I am receiving the error "Unexpected error while setting values for attachment..." The error disappears when I remove the placement option. The values reference are valid "<player name="Americans" optional="false"/>" & "<unit name="airfield"/>". What am I doing wrong?

    <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="trigger" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
          <option name="when" value="after:americansPlace"/>
          <option name="placement" value="Americans:airfield"/>
    </attachment>
    
    

    I'm almost sure "trigger", if still working, is a very long time deprecated option, in favour of same-behaving "conditions".

    @redrum @LaFayette @RoiEX Is there a place were deprecated items are kept track of? Did veqryn let you know about any list he made. I know since @redrum deprecates, they are kept track of in pos2, until removed, but, before redrum, deprecates were not kept in there (quite reasonable, as that is a guide, so no need telling people any deprecated elements they should never use anyways), so I assume veqryn and whoever else before were tracking them somewhere else.

    ?



  • @Cernel I'm seriously giving Dislikes for blatant overuse of commas now 😜

    Cernel put 8 commas in 1 sentence rooofl


  • Admin

    @Cernel POS2 is where they are tracked but for anything done before my involvement, they might not be included.


  • Moderators Admin

    @RogerCooper Anyways, what that option is doing is trying to place 1 (default count) unit called "airfield" in a zone called "Americans". The only way it can not work is that you don't have one of these.


  • Admin

    @RogerCooper As @Cernel points out, I believe the issue is you need to specify the territory not player in the "placement" option like this:

    <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="trigger" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
          <option name="when" value="after:americansPlace"/>
          <option name="placement" value="Guadacanal:airfield"/>
    </attachment>
    

  • Moderators Admin

    @redrum said in Problem with TriggerAttachment using placement option:

    @RogerCooper As @Cernel points out, I believe the issue is you need to specify the territory not player in the "placement" option like this:

    <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="trigger" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
          <option name="when" value="after:americansPlace"/>
          <option name="placement" value="Guadacanal:airfield"/>
    </attachment>
    

    And, if I'm right that the option "trigger" was deprecated ages ago, it would rather be this:

    <attachment name="triggerAttachmentAmericansBuildAirfieldAtGuadacanal" attachTo="Americans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
          <option name="conditions" value="conditionAttachmentAmericansCanBuildAtGuadacanal"/>
          <option name="when" value="after:americansPlace"/>
          <option name="placement" value="Guadacanal:airfield"/>
    </attachment>
    

    I personally also specify a count, in these cases, despite the default being 1 (not sure if this is a good or bad practice, writing useless counts equal to default?).





  • @Cernel Thank you, I will fix it.


Log in to reply