Changes

Jump to navigation Jump to search
→‎Overview: + Queries versus Content Patcher conditions
Line 15: Line 15:     
You can add quotes to keep spaces within an argument. For example, <code>BUILDINGS_CONSTRUCTED Here "Junimo Hut"</code> passes <code>Junimo Hut</code> as one argument. You can escape inner quotes with backslashes like <code>ANY "BUILDINGS_CONSTRUCTED Here \"Junimo Hut\""</code>. Remember that quotes and backslashes inside JSON strings need to be escaped too, like <code>"Condition": "BUILDINGS_CONSTRUCTED Here \"Junimo Hut\""</code>.
 
You can add quotes to keep spaces within an argument. For example, <code>BUILDINGS_CONSTRUCTED Here "Junimo Hut"</code> passes <code>Junimo Hut</code> as one argument. You can escape inner quotes with backslashes like <code>ANY "BUILDINGS_CONSTRUCTED Here \"Junimo Hut\""</code>. Remember that quotes and backslashes inside JSON strings need to be escaped too, like <code>"Condition": "BUILDINGS_CONSTRUCTED Here \"Junimo Hut\""</code>.
 +
 +
===Queries versus Content Patcher conditions===
 +
[[Modding:Content Patcher|Content Patcher packs]] can have conditions using either game state queries or Content Patcher's <samp>When</samp> conditions.
 +
 +
Which you use is mainly a performance tradeoff:
 +
* Content Patcher's <samp>When</samp> conditions are highly optimized and cached, so thousands of patches can check the same condition without impacting performance and the resulting changes are written once to the asset. Then there's no performance impact after the asset edit, since it's just plain unconditional data. However the asset is reloaded when patches are added/removed, which may impact performance if they change often in some cases (like reloading a map or indoor/outdoor NPC appearance).
 +
* A game state query has no caching, so it can significantly affect performance when it's checked often. For example, a thousand game state queries checked each update tick means sixty thousand condition evaluations per second. On the other hand, game state queries are faster in cases where the conditions are checked rarely and doing so avoids reloading textures or maps (like <samp>ChooseAppearance</samp> in <samp>Data/Characters</samp> or <samp>Music</samp> in <samp>Data/Locations</samp>).
    
==Built-in queries==
 
==Built-in queries==
translators
8,439

edits

Navigation menu