Changes

Jump to navigation Jump to search
+ overview of valid fields & format
Line 3: Line 3:  
← [[Modding:Index|Index]]
 
← [[Modding:Index|Index]]
   −
This page documents '''item queries''', a built-in way to create one or more items based on a string command.
+
This page documents '''item queries''', a built-in way to create one or more items dynamically, instead of specifying a single item ID.
   −
''Item queries'' choose one or more items dynamically, instead of specifying a single item ID. These are used in various places like [[#Custom machines|machine data]] and [[#Custom shops|shop data]].
+
==Overview==
 +
===Valid fields===
 +
These are used in various places like [[#Custom machines|machine data]] and [[#Custom shops|shop data]]. These can only be used if the field docs specifically mentions that it allows item queries.
 +
 
 +
===Query format===
 +
An item query consists of a string containing a query name with zero or more [[#Argument format|arguments]]. See the [[#Available queries|list of queries below]].
 +
 
 +
'''⚠''' Item queries are partly case-sensitive. While some values are case-insensitive, this isn't consistent. Using the exact capitalization is recommended to avoid issues.
 +
 
 +
===Argument format===
 +
Item queries can take space-delimited arguments. For example, <code>RANDOM_ITEMS (F) 1376 1390</code> has three arguments: <code>(F)</code>, <code>1376</code>, and <code>1390</code>.
 +
 
 +
If you have spaces within an argument, you can surround it with quotes to keep it together. For example, <code>LOST_BOOK_OR_ITEM "RANDOM_ITEMS (O)"</code> passes <code>RANDOM_ITEMS (O)</code> as one argument. You can escape inner quotes with backslashes if needed.
 +
 
 +
Remember that quotes and backslashes inside JSON strings need to be escaped too. For example, <code>"ItemId": "LOST_BOOK_OR_ITEM \"RANDOM_ITEMS (O)\""</code> will send <code>LOST_BOOK_OR_ITEM "RANDOM_ITEMS (O)"</code> to the game code. Alternatively, you can use single-quotes for the JSON string instead, like <code>"ItemId": 'LOST_BOOK_OR_ITEM "RANDOM_ITEMS (O)"'</code>.
    
==Available queries==
 
==Available queries==
translators
8,445

edits

Navigation menu