renpy.list_files using cached results

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
SusanTheCat
Miko-Class Veteran
Posts: 952
Joined: Mon Dec 13, 2010 9:30 am
Location: New Brunswick, Canada
Contact:

renpy.list_files using cached results

#1 Post by SusanTheCat » Sun Apr 10, 2016 7:35 pm

I have a program that creates dot to dot files and reads them back.

Except, if you make a new file, renpy.list_files does not show it until you restart the program.

how can I force it to reload the cache?

Susan
Currently typing from hospital room. I am soooo bored.
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas

User avatar
PyTom
Ren'Py Creator
Posts: 15437
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: renpy.list_files using cached results

#2 Post by PyTom » Sun Apr 10, 2016 8:45 pm

We do this for speed reasons, so it's not something that can be bypassed easily. What are you fundamentally trying to do?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
SusanTheCat
Miko-Class Veteran
Posts: 952
Joined: Mon Dec 13, 2010 9:30 am
Location: New Brunswick, Canada
Contact:

Re: renpy.list_files using cached results

#3 Post by SusanTheCat » Sun Apr 10, 2016 9:41 pm

When you load the program, you can make a puzzle or play a puzzle.

To make a puzzle: use the program to make a series of dots, then you save the dots to an XML.

I want to be able to load the newly made xml to play without reloading the program.

It is not a program killer if I have to reload. I'll just have it exit after it saves.

Susan
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: renpy.list_files using cached results

#4 Post by xela » Mon Apr 11, 2016 1:40 am

Under what circumstances can you save a file to a disk but not load it using the same method you've used for saving?
Like what we're doing? Support us at:
Image

User avatar
SusanTheCat
Miko-Class Veteran
Posts: 952
Joined: Mon Dec 13, 2010 9:30 am
Location: New Brunswick, Canada
Contact:

Re: renpy.list_files using cached results

#5 Post by SusanTheCat » Mon Apr 11, 2016 1:50 am

I could have a "play this file" menu instead of being lazy and reusing my main menu..

You could have you work on file A then on file B then you want to test file A.

I should just bite the bullet and have two seperate programs for playing and editing.

Susan
Insomnia is a wonderful thing
" It's not at all important to get it right the first time. It's vitally important to get it right the last time. "
— Andrew Hunt and David Thomas

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: renpy.list_files using cached results

#6 Post by xela » Mon Apr 11, 2016 1:56 am

I don't follow but regardless, you cannot (normally) save a file to a disk without using something that can scan any folder and load the file... Normally you'd be using os module to save/load (will prolly not work on mobile devices), os module would have os.listdir method to list all files in specific directory and many others as well.
Like what we're doing? Support us at:
Image

User avatar
PyTom
Ren'Py Creator
Posts: 15437
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: renpy.list_files using cached results

#7 Post by PyTom » Mon Apr 11, 2016 10:42 am

Yeah, it's probably best to just use open to open a file for loading and saving, and then os.listdir or os.path.exists for checking for file existence.

Ren'Py's internal caching really isn't meant for this.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: zankizuna