Respackopts/docs/old/expand.md
2021-09-15 15:17:32 +02:00

1.2 KiB

Resource expansion

You can use the expansions block in your .rpo to replace content with a value computed through executing a custom starscript. All values are available in starscript like this: <pack id>.<entry>

Example:

en_us.json.rpo:

"expansions": {
  "lights": "{lumi.subcategoryTest.enableLang}",
  "mode": "{lumi.debugMode}",
  "normal": "{lumi.numTest * lumi.subcategoryTest.numberInSub}",
  "lumi": "model",
  "regeneration": "Industrie"
}

en_us.json:

{
  "rpo.lumi": "${lumi} ${lights}",
  "rpo.lumi.tonemap": "Tonemap mode",
  "rpo.tooltip.lumi.tonemap": "Tooltip test",
  "rpo.lumi.pbr": "Enable PBR",
  "rpo.lumi.debugMode": "Debug Mode",
  "rpo.lumi.debugMode.normal": "${normal} Mode",
  "rpo.lumi.waterVertexWavy": "Wavy water model",
  "rpo.tooltip.lumi.subcategoryTest.sliderTest": "Yayyy"
}

Explanation

The expansions block contains a key ("lights") and a script, which is executed when the file is loaded. All instances of the key (formatted as ${name} -> ${lights} in this example) will be replaced by the result of the script. Make sure to only use this feature on text files as unexpected results my occur otherwise