Skip to content

Commit e87a248

Browse files
authored
v3.0.0 release (#19)
* v3.0.0 release candidate * Update README.md * Update README.md * fix unique multipickup
1 parent d20a7bb commit e87a248

21 files changed

Lines changed: 181 additions & 100 deletions

dist/simple-inventory.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/simple-inventory.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Guide.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Both of the above would remove 10 items with the ID `"wood"` and 5 items with th
106106
> [!TIP]
107107
> If the inventory doesn't contain an item it's asked to drop, nothing happens. No errors will be thrown, and the items that are present in the command, if any, will be removed as normal. Please be careful as this may hide some bugs.
108108
109-
You can also remove all of the items in one inventory from another inventory by <em>**un**merging</em> the latter drom the former. Like merging, unmerging does not affect the giving inventory, if you want to remove the items from one inventory and add them to another, see [transfers](#transfers) below.
109+
You can also remove all of the items in one inventory from another inventory by <em>**un**merging</em> the latter from the former. Like merging, unmerging does not affect the giving inventory, if you want to remove the items from one inventory and add them to another, see [transfers](#transfers) below.
110110

111111
```
112112
<<newinv _stolenItems>>
@@ -282,7 +282,15 @@ Want to add an option to drop all items? And how about a way to inspect the item
282282

283283
![Inventory with everything](media/inv-fully-loaded.jpg)
284284

285-
You may also provide the flag`stack` to allow players to drop/transfer entire stacks of items all at once:
285+
There is also a built-in search/filter UI element you can add with the `filter` flag. This will allow players to type to filter the inventory.
286+
287+
```
288+
<<inv $backpack use drop inspect all filter>>
289+
```
290+
291+
![Inventory with everything](media/filter.jpg)
292+
293+
You may also provide the flag `stack` to allow players to drop/transfer entire stacks of items all at once:
286294

287295
```
288296
<<inv $backpack use drop inspect stack all>>
@@ -317,23 +325,23 @@ You can change the default strings used by the built-in interfaces, for example,
317325

318326
The strings that can be changed in the special passage are as follows:
319327

320-
- `inspect`: **not used** in the default interface, since the user clicks on the names of items to see their descriptions, however, a link for inspecting items may be needed in the future or by users. Default: `"Inspect"`
321-
- `drop`: appears as link text when users can drop items in the interface. Default: `"Drop"`
322-
- `take`: can appear as link text when users can transfer items in the interface. Default: `"Take"`
323-
- `give`: can appear as link text when users can transfer items in the interface. Default: `"Give"`
324-
- `use`: link text for the action allowing consumables to be used. Default: `"Use"`
325-
- `stack`: the text used to refer to an item stack when dropping or transferring whole stacks in the default interface. Default: `"stack"`
326-
- `stackPre`: string appears before the item stack counts. Default: `"&nbsp;&times;&nbsp;"` (that is,&nbsp;&times;&nbsp;)
327-
- `stackPost`: string appears after the item stack counts. Default: `"&nbsp;"`
328-
- `empty`: this string appears when an empty inventory is displayed. In the API, this is handled by a separate property, `Inventory.emptyMessage`, passing this value to `Inventory.strings` won't have any effect! Default: `"&hellip;"`
328+
- `inspect`: **not used** in the default interface, since the user clicks on the names of items to see their descriptions, however, a link for inspecting items may be needed in the future or by users. Default: `Inspect`
329+
- `drop`: appears as link text when users can drop items in the interface. Default: `Drop`
330+
- `take`: can appear as link text when users can transfer items in the interface. Default: `Take`
331+
- `give`: can appear as link text when users can transfer items in the interface. Default: `Give`
332+
- `use`: link text for the action allowing consumables to be used. Default: `Use`
333+
- `stack`: the text used to refer to an item stack when dropping or transferring whole stacks in the default interface. Default: `stack`
334+
- `stackPre`: string appears before the item stack counts. Default: `&nbsp;&times;&nbsp;` (that is,&nbsp;&times;&nbsp;)
335+
- `stackPost`: string appears after the item stack counts. Default: `&nbsp;`
336+
- `empty`: this string appears when an empty inventory is displayed. In the API, this is handled by a separate property, `Inventory.emptyMessage`, passing this value to `Inventory.strings` won't have any effect! Default: `&hellip;`
329337

330338
For example, an `inventory.strings` special passage may look like this:
331339

332340
```
333341
:: inventory.strings
334-
use: "Activate"
335-
take: "Swipe"
336-
empty: "The inventory is empty!"
342+
use: Activate
343+
take: Swipe
344+
empty: The inventory is empty!
337345
```
338346

339347
To do the same thing with the API, the JavaScript code would look like this:

docs/Macros.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ These macros can be used to show the default user-interface components for manag
205205
- `use` allows the player to "use" an item if it is considered a consumable, and using it will expend one of the items and cause it's use code, if any, to be run. Refer to the `<<item>>` macro below.
206206
- `stack` shows a "Drop/Give/Take stack" option at the end of each item listing with more than 1 item in it.
207207
- `all` shows a "Drop/Give/Take all" option at the bottom of the inventory list.
208+
- `filter` shows filter/search box for players to filter their inventories with.
208209

209210
#### Examples
210211

@@ -226,6 +227,12 @@ These macros can be used to show the default user-interface components for manag
226227

227228
![Inventory with everything](media/inv-fully-loaded.jpg)
228229

230+
```
231+
<<inv $backpack use drop inspect all filter>>
232+
```
233+
234+
![Inventory with filter box](media/filter.jpg)
235+
229236
```
230237
<<inv $backpack use drop inspect stack all>>
231238
```
@@ -314,8 +321,9 @@ For example:
314321

315322
```
316323
:: inventory.strings
317-
use: "Activate"
318-
take: "Swipe"
324+
use: Activate
325+
take: Swipe
326+
drop: Discard
319327
```
320328

321329
The strings you can change are:

docs/README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Simple Inventory 3
22

3-
> [!NOTE]
4-
> Simple Inventory v3 is in beta right now. It should work, but there may be bugs and rough edges. Please [report any issues](https://github.com/ChapelR/simple-inventory/issues/new) you encounter!
3+
The new simple inventory system. No longer a part of [my macro collection](https://macros.twinelab.net/), it's now its own thing. If you need the old version, grab [an older release (v2.10.0 or lower) of my custom macro collection](https://github.com/ChapelR/custom-macros-for-sugarcube-2/releases). If you find any bugs or have any issues, please [let me know](https://github.com/ChapelR/simple-inventory/issues/new)!
54

6-
The new version of my simple inventory system. No longer a part of [my macro collection](https://macros.twinelab.net/), it's now its own thing. If you need the old version, grab [an older release (v2.10.0 or lower) of my custom macro collection](https://github.com/ChapelR/custom-macros-for-sugarcube-2/releases).
5+
> [!TIP]
6+
> New to Simple Inventory? Start with the [guide](Guide.md) and [recipes](Recipes.md) to see what the system is capable of!
77
88
- [Downloads](https://github.com/ChapelR/simple-inventory/releases)
99
- [Installation](#getting-started)
@@ -20,19 +20,17 @@
2020
- [Demo](demo.html ":ignore")
2121
- [Source Code](https://github.com/ChapelR/simple-inventory/)
2222

23-
Version 3 includes most of the features and functionality of v2, and adds:
24-
25-
- Consumables. Items can be associated with SugarCube code (sort of like a widget) or a callback function that can be executed when the item is "used."
26-
- Item descriptions (as dialogs).
27-
- Item names. You can provide items with both names and IDs, using the ID in code while the name will be used for displaying it in the game.
28-
- Item and inventory tags. You can add tags to items and inventories as metadata.
29-
- Item stacking. Duplicate items in an inventory can now *stack* meaning they'll take up one visual "slot" in the inventory, but will have a counter showing how many are present.
30-
- More robust built-in UI options and components.
31-
- A cleaned up, mostly simplified API and code structure.
32-
33-
Most new features are optional; you don't have to define items, for example. With the exception of stacking, it's possible to use this inventory in almost exactly the same way as v2.
34-
35-
This new simple inventory is totally incompatible with previous versions. Updating will require rewrites, so you may want to stick with v2 in ongoing projects.
23+
Features:
24+
- Support for an arbitrary number of inventories, so they can be used as player inventories, chests, rooms, NPC inventories, etc.
25+
- Simple interfaces for complex operations, like inventory transfers, merges, and comparisons.
26+
- Items can optionally be predefined, but you may also just use bare strings for ultimate simplicity.
27+
- Premade logic for unique and un-tradeable items.
28+
- Built-in support for "consumables" like potions, which can be paired with a code "handler" for easy item creation.
29+
- Duplicate items in a given inventory "stack" automatically.
30+
- A suite of customizable UI components for displaying and allowing users to manage inventories easily.
31+
- Text search/filter system built-in as an optional UI component.
32+
33+
Most features are optional; you don't have to define items, for example. With the exception of stacking, it's possible to use this inventory in almost exactly the same way as v2. Note that this new simple inventory is totally incompatible with previous versions. Updating will require code rewrites, so you may want to stick with v2 in ongoing projects.
3634

3735
## Getting Started
3836

docs/demo.html

Lines changed: 9 additions & 9 deletions
Large diffs are not rendered by default.

docs/media/filter.JPG

28.2 KB
Loading

docs/recipes/collectibles.html

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

docs/recipes/crafting.html

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

docs/recipes/equipment.html

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)