[Solved] Help with an inventory sistem using screen language
Posted: Tue Apr 19, 2022 11:27 pm
Hi guys.
I am quite new to thiss.
What I am trying to do is a screen wich portrays the items the player has. I saw some models with python but i find too complex for what i am doing. Instead I tried to use a vbox with an if statement and a add image for each item. Works fine but the problem is that they are aligned vertically and i actually want them to be in a grid (4 for infinite). This is the test:
So I tried a grid but the issue is that I need to display them in a particular order, wich may not be how the player gets them, or loose them. If the player gets the banana first he will get an empty square and then a banana. With an inventory who could have 20 or 30 items it will look wierd.
This is just a test with three items.
Do anyone knows a solution to do what i am triyng to do ?
Thnks.
I am quite new to thiss.
What I am trying to do is a screen wich portrays the items the player has. I saw some models with python but i find too complex for what i am doing. Instead I tried to use a vbox with an if statement and a add image for each item. Works fine but the problem is that they are aligned vertically and i actually want them to be in a grid (4 for infinite). This is the test:
Code: Select all
screen phone_menu:
modal True
add bg_phone
imagebutton auto "phone_icon_end_but_%s":
focus_mask True
hovered SetVariable("screen_tooltip","phone_icon_end")
unhovered SetVariable("screen_tooltip", "")
action Hide ("phone_menu")
hbox:
align(0.44, 0.22)
if aple == True:
add "aple_inventory"
if banana == True:
add "banana_inventory"
if anana == True:
add "anana_inventory"This is just a test with three items.
Code: Select all
screen phone_menu2:
modal True
add bg_phone
imagebutton auto "phone_icon_end_but_%s":
focus_mask True
hovered SetVariable("screen_tooltip","phone_icon_end")
unhovered SetVariable("screen_tooltip", "")
action Hide ("phone_menu2")
side "c r":
area (740, 195, 445, 750)
viewport id "vp":
draggable True
has vbox
vbox:
grid 2 2:
if aple == True:
add "aple_inventory"
else:
null
if banana == True:
add "banana_inventory"
else:
null
if anana == True:
add "anana_inventory"
else:
null
nullThnks.