chapelr / simple-inventory Goto Github PK
View Code? Open in Web Editor NEWAn inventory system for Twine 2/SugarCube 2.
Home Page: https://inventory.twinelab.net
License: The Unlicense
An inventory system for Twine 2/SugarCube 2.
Home Page: https://inventory.twinelab.net
License: The Unlicense
Method that returns true if the inventory contains all the items in an itemset, + a relevant macro.
Create a simple RPG-style equipment system, using item/inventory tags to manage it.
New major version, will have many breaking changes.
Core new features (all optional):
Itemset merging should allow users merge inventories together.
I may be over-complicating things and should just build my own UI to do this, but maybe it makes sense to have built in.
The reason I would like this feature is to use the inventory for a trading system.
The user-supplied function should be able to:
from
and to
argument that gets passed the inventory names.Items should accept metadata, which will be assigned internally: the private array will be an array of objects rather than strings.
Each item will have:
Users will also be able to define (non-statefully) items via a new API and macro set.
Items have:
If an item is passed to an inventory that doesn't have an item def, it will be treated like a key item, per the current implementation of SI, plus the new automatic metadata properties.
Items will probably be a class, the metadata passed into the inventory will probably include the whole instance. Might be better as a straight up factory, though.
These additions shouldn't be breaking, if implemented properly, but the code will be heavier, so it may be worth adding the hooks for this system to Simple Inventory, but making the Item class and API / macros an optional extension.
Design goals.
https://twinelab.net/simple-inventory//#/Recipes?id=shops
If you Go to Market, then Buy Items, any Item you buy will have the price of the last item listed.
For instance, coal, price 2, is purchased at iron ingot's price of 12.
This issue also happens with Sell Items.
Hello!
it will be perfecto to add the description when using loops for inv.table. Also, the option to create links to popup, use or drop outside the defined interface (i think its not possible now).
Thank you!
Something changed between 3.0 beta and the final release. In the beta, inventory inspect would show the item name, but now it shows the item id.
I'd assumed it was an error between user and keyboard, but it is also easy to spot in the various recipes on the Simple Inventory website.
Imagine the following sequence:
Item.extendPrototype({ image: "" });
Item.add("Book", { image: "book.png", description: "A book" });
Item.add("Dog", { image: "dog.png", description: "A dog" });
Item.add("Ring", { description: "A Ring" });
This should add an image
property to an item, with a default value of an empty string. I would expect this to be set as given on both Book
and Dog
and blank on Ring
.
However this is not the case:
Item.get("Book").image => "book.png"
Item.get("Dog").image => "dog.png"
Item.get("Ring").image => "dog.png"
It appears that the last value supplied for the image property applies to all subsequent Items, as if the default values had been modified.
I suspect the error is here:
Object.assign(this, Object.assign(defaultOpts, opts));
This should probably be:
Object.assign(this, Object.assign({}, defaultOpts, opts));
Is there a known issue with exporting and importing? On my twine game the inventory systems works fine, but inventory content is not saved on export. I verified this with a button:
<<button "Serialize Game" >>
<<script>>
const myGameState = Save.serialize();
if (myGameState === null) {
/* Failure. You've disallowed saving. */
}
console.log(LZString.decompressFromBase64(myGameState));
Save.deserialize(myGameState);
<</script>>
Doing this will empty out my inventory. The output from the Save.serialize() is logged and shows there is nothing in the inventory array. perhaps a problem with marshalling?
Need to add Babel to build process to compile to ES5. Issue to remind me.
Ideas for examples:
When this code defines the <> macro, it also a defines a list of options that includes a dropActionText property, which is assigned a value of 'Drop'.
The value of that dropActionText property is later passed as an argument to the addon's dropLink() function, that generates the "drop" related link for an inventory item.
And unfortunately that dropLink() function will use that argument value instead of the Inventory.strings.drop setting, if the argument is not an empty String.
The interface should have "take/give/drop all" options. Should be optional via an all
flag.
Give/drop all optional confirmation?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.