LezInventory - Free Inventory Framework!

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Lezalith
Regular
Posts: 82
Joined: Mon Dec 21, 2015 6:45 pm
Contact:

LezInventory - Free Inventory Framework!

#1 Post by Lezalith »

LezInventory

Free Inventory Framework by Lezalith

Hi, welcome everyone! It's so great to have you here!

My name is Lezalith, Lez for short. I've been working in Ren'Py for about 7 years, I've gathered plenty of experience,
and I've been trying to give back to the community, in the form of helping on the Ren'Py Discord and writing tutorials.

Today, I contribute another piece. LezInventory, and Inventory Framework that anybody can take and use!

Features of LezInventory include, but are not limited to:

  • Holding items that have a name, a description and an image
  • Easy customization of the whole Inventory screen
  • Customization done through styles, just as in default Ren'Py projects
  • One equip slot where an equippable item can be equipped
  • Usable items optionally consumed upon being used
  • Settings that allow you to change the basic settings in seconds

Default looks of the Inventory
Default looks of the Inventory

This is how the Inventory looks like when you first load up the downloaded project.
It is a 3x3 grid with one slot for equipping an item, along with options to Equip, Use or Throw Away items.

However, it is quite easy to customize. Equippable items not up your alley? Just modify few lines and voilá...


2x2 Version of the Inventory
2x2 Version of the Inventory

Every bit of code is commented. If you want to change the functionality of something, it should be a breeze!


Commented script files
Commented script files

But hey, how do you make sense of all of that??
Quite easily! There are two documentation files included, one to set up the Inventory, and one that teaches you
how to define your own items!


Documentation files
Documentation files

If you like what you see, you can check out the link below to download the LezInventory project!
It includes fifteen example items which show off what the Inventory is capable of,
as well as the first steps for setting up the Inventory yourselves!



This link right here!


Finally, if you like LezInventory and want to support me, you can become my patron on Patreon,
check out my other work like my Ren'Py Tutorials, or write me some feedback on Discord (Lezalith (LezCave.com)#2853)!
Thank you very much for reading this, you're all awesome!

User avatar
Renpie
Newbie
Posts: 14
Joined: Sat Jul 11, 2015 9:49 am
Contact:

Re: LezInventory - Free Inventory Framework!

#2 Post by Renpie »

I needed to remove an item outside of the inventory, so I added simple function to check if you have the item and then remove the first one in the list

Edit: Some container inventory would be nice so you could leave stuff in some room. I'll try to figure this out. Not good with python.

User avatar
Lezalith
Regular
Posts: 82
Joined: Mon Dec 21, 2015 6:45 pm
Contact:

Re: LezInventory - Free Inventory Framework!

#3 Post by Lezalith »

Renpie wrote: Thu Jun 17, 2021 12:01 am I needed to remove an item outside of the inventory, so I added simple function to check if you have the item and then remove the first one in the list

Edit: Some container inventory would be nice so you could leave stuff in some room. I'll try to figure this out. Not good with python.
Wow, that was a stupid thing of me not to add!

I just fixed that! The files on LezCave.com have been updated. See the code addition:

Code: Select all

        # Removes an Item from the inventory.
        # If Item is not specified, it will remove the selected item.
        def remove(self, Item = None):

            # Specified Item
            if Item != None:

                if Item in self.inventory:

                    # Unequip the Item if it's equipped.
                    if Item == self.getEquippedItem():

                        self.unequip()

                    # Unselect the Item if it's selected.
                    if Item == self.getSelectedItem():
                        self.unselect()

                    # Remove the Item from the inventory.
                    self.inventory.remove(Item)

                    # Check pages whether we don't have
                    # (an) empty one(s) after the removal.
                    self.checkPages()

                    return

            # Removing Selected Item:
            
            ...

Newbie1104
Newbie
Posts: 3
Joined: Thu Oct 04, 2018 6:48 pm
Contact:

Re: LezInventory - Free Inventory Framework!

#4 Post by Newbie1104 »

Hi, just see this and it looks much cleaner than what I'm using. Unfortunately I can't test it yet.

Just a question, can this be easily modified to make some items stackable?

Post Reply

Who is online

Users browsing this forum: No registered users