Page 1 of 1

Applying persistent data to items in a list

Posted: Sun Jan 20, 2019 6:51 pm
by AikoYamamoto
Is there anybody who can help me with this? I've been strugling for this about 2 hours and can't get an idea how to apply persistent statement from renpy for each tip in a list using an id_name.

For example:

charachter_a "blah-blah-blah-blah"
$persistent.tip(id_name) = unlocked"

Here's my code:

init -1 python:
class Tips:
def __init__(self, number, name, category, desc, unlockable, id_name):
self.name = name
self.category = category
self.number = number
self.desc = desc
self.unlockable = unlockable
self.id_name = id_name

show_desc = None

massive = [
Tips("01", "Lab", "Random", "qweqe qwe2312 qwlke mqwlk meqwe", "locked", "lab"),
Tips("02", "University", "Building", "qweqe qwe qwlke mqasdasd1231dasd as dasd asd12 dadqw asd wlk meqwe", "locked", "tdu")
]

screen glossary():
tag menu
add "menu/tips/tips_bg.png"
viewport:
xpos 50 ypos 100 xsize 300 ysize 500
scrollbars "vertical"
spacing 3
draggable True
mousewheel True
arrowkeys True
vbox:
for tip in massive:
if tip.unlockable == "unlocked":
textbutton tip.number +" "+ tip.name action SetVariable("show_desc", tip) text_size 16
else:
textbutton tip.number + " ????" action NullAction() text_size 16
if show_desc:
text show_desc.desc

imagebutton idle "menu/clearlist/back_btn.png" xalign 0.95 yalign 0.95 focus_mask True action Return()

Re: Applying persistent data to items in a list

Posted: Tue Jan 22, 2019 9:28 am
by isobellesophia
Hello there!

You can visit this site if you love to.

viewtopic.php?t=51990

It is a glossary screen or whatever its called.

It is along with persistent data which you can unlock whatever you wanted.

Hope i could help. :P