Changes

→‎Item queries: update for build 23339 (simplified RANDOM_ITEMS format)
Line 6,293: Line 6,293:  
| A random seasonal vanilla item which can be found by searching garbage cans, breaking containers in the mines, etc.
 
| A random seasonal vanilla item which can be found by searching garbage cans, breaking containers in the mines, etc.
 
|-
 
|-
| <samp>RANDOM_ITEMS {{t|type definition ID}} {{o|options}}</samp>
+
| <samp>RANDOM_ITEMS {{t|type definition ID}} {{o|min ID}} {{o|max ID}} {{o|require price}}</samp>
| Random items from the given [[#Item types|type definition ID]], with any combination of the following criteria and options (in any order, all optional):
+
| All items from the given [[#Item types|type definition ID]] in randomized order, optionally filtered to those with a numeric ID in the given {{o|min ID}} and {{o|max ID}} range (inclusive). If {{o|require price}} is <samp>true</samp>, items with a sell-to-shop price below {{price|1}} won't be returned.
 
  −
{| class="wikitable"
  −
|-
  −
! format
  −
! item criteria
  −
|-
  −
!colspan="2"| search criteria
  −
|-
  −
| <samp>@has_category {{o|category}}</samp>
  −
| Must have one of the given [[Modding:Items#Categories|object categories]] (space-delimited), or any valid category if none specified. Can be negated with <samp>@!has_category</samp>.
  −
|-
  −
| <samp>@has_id {{t|id}}+</samp>
  −
| Must have one of the given unqualified item IDs. Can be negated with <samp>@!has_id</samp>.
  −
|-
  −
| <samp>@has_id_in_base_range {{t|min}} {{t|max}}</samp>
  −
| Must have a numeric ID between the {{t|min}} and {{t|max}} values (inclusive). Can be negated with <samp>@!has_id_in_base_range </samp>.
  −
|-
  −
| <samp>@has_id_prefix {{t|prefix}}+</samp>
  −
| Must have an unqualified item ID starting with one of the given prefixes. For example, <samp>@has_id_prefix ExampleAuthor_ExampleMod_</samp> for a mod's items. Can be negated with <samp>@!has_id_prefix</samp>.
  −
|-
  −
| <samp>@has_object_type {{o|type}}+</samp>
  −
| Must have one of the given object ty pes (space-delimited), or any valid type if none specified. Can be negated with <samp>@!has_object_type</samp>.
  −
|-
  −
!colspan="2"| options
  −
|-
  −
| <samp>@allow_missing_price</samp>
  −
| Allow items with a base sell price of 0 or lower. If omitted, those items are skipped.
  −
|-
  −
| <samp>@count {{t|count}}</samp>
  −
| The number of random items to return. Default 1.
  −
|-
  −
| <samp>@require_explicit_category</samp>
  −
| Whether to ignore items with category 0 in <samp>Data/Objects</samp>. These are often (but not always) special items like [[Secret Note]] or unimplemented items like Lumber.
  −
|}
      
For example, you can sell a random [[wallpaper]] for {{price|200}} in <samp>Data/Shops</samp>:
 
For example, you can sell a random [[wallpaper]] for {{price|200}} in <samp>Data/Shops</samp>:
Line 6,334: Line 6,300:  
{
 
{
 
     "ItemId": "RANDOM_ITEMS (WP)",
 
     "ItemId": "RANDOM_ITEMS (WP)",
 +
    "MaxItems": 1,
 
     "Price": 200
 
     "Price": 200
 
}
 
}
Line 6,341: Line 6,308:  
<syntaxhighlight lang="js">
 
<syntaxhighlight lang="js">
 
{
 
{
     "ItemId": "RANDOM_ITEMS (F) @has_id_in_base_range 1376 1390"
+
     "ItemId": "RANDOM_ITEMS (F) 1376 1390",
 +
    "MaxItems": 1
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 6,348: Line 6,316:  
<syntaxhighlight lang="js">
 
<syntaxhighlight lang="js">
 
{
 
{
     "ItemId": "RANDOM_ITEMS (O) @has_id_prefix AuthorName_ModName_"
+
     "ItemId": "RANDOM_ITEMS (O)",
 +
    "MaxItems": 1,
 +
    "PerItemCondition": "ITEM_ID_PREFIX Target AuthorName_ModName_"
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 6,355: Line 6,325:  
<syntaxhighlight lang="js">
 
<syntaxhighlight lang="js">
 
{
 
{
     "ItemId": "RANDOM_ITEMS (O) @has_category @!has_category -13 -14 @count 10"
+
     "ItemId": "RANDOM_ITEMS (O)",
 +
    "MaxItems": 10,
 +
    "PerItemCondition": "ITEM_CATEGORY, !ITEM_CATEGORY Target -13 -14
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
translators
8,404

edits