Inventory Problem when exports.

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
tsuntere
Newbie
Posts: 3
Joined: Sat Jan 13, 2024 10:33 pm
Contact:

Inventory Problem when exports.

#1 Post by tsuntere »

Hi!

I have an issue with my inventory system. I'm using mac and, in my pc, I can see all images, descriptions and all. But the moment I export to windows or apk, the inventory is gone and you can only see the no_object image.

This is my code. Thanks in advance!

init python:
inventory_objects = ["images/1.png", "images/2.png", "images/3.png", "images/4.png", "images/5.png", "images/6.png","images/7.png" ]
#Nombre objetos.
item_name = {
"images/1.png": "Name",
"images/2.png": "Name",
"images/3.png": "Name",
"images/4.png": "Name",
"images/5.png": "Name",
"images/6.png": "Name",
"images/7.png": "Name",
}


description = {
"images/1.png": "Description",
"images/2.png": "Description",
"images/3.png": "Description",
"images/4.png": "Description",
"images/5.png": "Description",
"images/6.png": "Description.",
"images/7.png": "Description",
}

#Variable para el nombre del ítem.
name_item = ""
story_name_item = ""
#Variable para mostrar la descripción.
show_description = ""
#Variable para mostrar el ítem seleccionado.
show_item = ""
#Variable para comprobar si el inventario está abierto.
open_inventory = False

#Lista Persistente para desbloquear los ítems.
default persistent.choice = []
#Diccionario Persistente.
default persistent.using_item = {
"images/1.png": False,
"images/2.png": False,
"images/3.png": False,
"images/4.png": False,
"images/5.png": False,
"images/6.png": False,
"images/7.png": False,
}

#Botón para el inventario.
screen inventory_button:
hbox:
xalign 0.01
yalign 0.0
imagebutton:
idle "box3"
action [Show("inventory_screen"), Hide("inventory_button")]

#Inventario.
screen inventory_screen:
modal True
add "inventory"
grid 7 1:
xalign 0.5
yalign 0.55
for item in inventory_objects:
if item in persistent.choice:
frame:
imagebutton idle item action [SetVariable("name_item", (item_name.get(item))), SetVariable("show_description", (description.get(item))), SetVariable("show_item", item), ToggleVariable("open_inventory", True)]
else:
frame:
image "no_object.png"

#Mostrar descripción cuando el inventario está abierto.
if open_inventory == True:
vbox:
xalign 0.5
yalign 0.3
for item in inventory_objects:
if item in persistent.choice and item == show_item:
image item:
xalign 0.5
text name_item:
xalign 0.5
text show_description:
xalign 0.5
frame:
xalign 1.0
yalign 0.0
textbutton "Close" action [Hide("inventory_screen"), Show ("inventory_button"), ToggleVariable("open_inventory", False)] xalign 1.0 yalign 0.0


label inventory:
$persistent.choice = []
show screen inventory_button

"red"
if "images/1.png" not in persistent.choice:
$persistent.choice.append("images/1.png")
else:
"already unlock"


"orange"
if "images/2.png" not in persistent.choice:
$persistent.choice.append("images/2.png")
else:
"already unlock"

"yellow"
if "images/3.png" not in persistent.choice:
$persistent.choice.append("images/3.png")
else:
"already unlock"

"green"
if "images/4.png" not in persistent.choice:
$persistent.choice.append("images/4.png")
else:
"already unlock"

"blue"
if "images/5.png" not in persistent.choice:
$persistent.choice.append("images/5.png")
else:
"already unlock"

"indigo"
if "images/6.png" not in persistent.choice:
$persistent.choice.append("images/6.png")
else:
"already unlock"

"violet"
if "images/7.png" not in persistent.choice:
$persistent.choice.append("images/7.png")
else:
"already unlock"

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Ocelot