Screen Vbox/Hbox issues

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Screen Vbox/Hbox issues

#1 Post by wyverngem »

I'm at a loss. I want to make an inventory script that shows 4 x 3 grid (See attached image.)

I want it to show the item picture if "$Item >=0". If it doesn't meet that conditional then it should not appear or take the space letting the next real item show. What I'd like is for one hbox that has a limit of 400px wide and 300 px tall. So that when an item doesn't exist then it space isn't taken up, but doesn't go out of bounds either.

If there was a way ideally I would use my blank.png to fill in the remaining spaces.

For example you have 12 spaces, but only 3 items right now. The 3 pictures would show, but the remaining would be the blank.png image. Also will probably use this same idea as a layered screen for quantity of the items.

Is there a way to do this?
Attachments
screen.jpg

apricotorange
Veteran
Posts: 479
Joined: Tue Jun 05, 2012 2:01 am
Contact:

Re: Screen Vbox/Hbox issues

#2 Post by apricotorange »

Something like the following?

Code: Select all

screen my_inventory:
  frame:
    has hbox:
      box_wrap True
    for i in items:
      add i
    for i in range(len(items), 12):
      add empty_box

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Screen Vbox/Hbox issues

#3 Post by wyverngem »

I'd use the inventory sample script, but I need to be able to store multiple items and tell the player how much their carrying. I'm pretty handy with if then statements so that's all figured out.

Yet, I went ahead and looked up "box_wrap". Just plain in the hbox it won't go to a specif size, just to the window of the main screen. I had to make a window and us left_margin and right-margin to make it fit into a specific size.

Thank you for the advice anyways! ^^; Coding is probably the hardest part for me, but I really am enjoying the challenge.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]