Content Patcher

Content Patcher

378k Downloads

[Content Patcher] Named args nested within positional args parsed incorrectly

Pathoschild opened this issue ยท 1 comments

commented

When parsing a positional input arg with nested named input args, the outer input arg is incorrectly split on the inner delimiter. The input parsing should work with the lex tokens instead of the raw text.

Repro steps

  1. Create a content pack with this content.json:

    {
        "Format": "1.23.0",
        "Changes": [
            {
              "Action": "EditData",
              "Target": "Characters/Dialogue/Abigail",
              "Entries": {
                 "Mon": "Hi!"
              },
              "When": {
                "HasValue: {{ChildNames |valueAt=1}}": "true"
              }
            }
        ]
    }
  2. Launch the game and wait for Content Patcher to load content packs.

Expected result: the HasValue input should be parsed into a single {{ChildNames |valueAt=1}} positional argument.

Actual result: the HasValue input is parsed into a {{ChildNames positional argument, and a named valueAt argument with the value 1}}. That results in an error like this:

Example > EditData Characters\Dialogue\Abigail: the When field is invalid: invalid 'valueAt' index '0}}', must be a numeric value.

Workaround

A temporary workaround is to move the inner argument into a dynamic token, so there's no nested input arg:

{
   "Format": "1.23.0",
   "DynamicTokens": [
      {
         "Name": "SecondChildName",
         "Value": "{{ChildNames |valueAt=1}}"
      }
   ],
   "Changes": [
           {
             "Action": "EditData",
             "Target": "Characters/Dialogue/Abigail",
             "Entries": {
                "Mon": "Hi!"
             },
             "When": {
               "HasValue: {{SecondChildName}}": "true"
             }
           }
       ]
   }
commented

This should be fixed via e06400c in the upcoming Content Patcher 1.24.3.