Simple Mailbox Using persistent data [HELP]

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
beastcarving
Regular
Posts: 89
Joined: Mon May 13, 2019 5:03 pm
Completed: Pulse Cage https://beastcarving.itch.io/pulse-cage-the-full-series
Projects: Your Brother's Religion
Organization: BeastCarving Studio
IRC Nick: BeastCarving
Tumblr: beastcarving
Deviantart: beastcarving
Github: beastcarving
itch: beastcarving
Contact:

Simple Mailbox Using persistent data [HELP]

#1 Post by beastcarving » Fri Feb 14, 2020 3:05 am

I've seen other's using a similar mail box function but none of those save the letters in your indox after exiting the game. I've tried using it myself by adjusting the code a bit, even after reloading and exiting the game, the mail box is empty again. How do I make the messages save using persistent data?
Image Pulse Cage (full game)Image Your Brother's Religion (Demo)
PLAY HERE: https://beastcarving.itch.io/
Love my work: https://www.patreon.com/beastcarving

User avatar
Per K Grok
Miko-Class Veteran
Posts: 628
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1
Projects: Defenders of Adacan Part 2
Deviantart: pekj
itch: per-k-grok
Location: Sverige
Contact:

Re: Simple Mailbox Using persistent data [HELP]

#2 Post by Per K Grok » Fri Feb 14, 2020 4:59 pm

beastcarving wrote:
Fri Feb 14, 2020 3:05 am
I've seen other's using a similar mail box function but none of those save the letters in your indox after exiting the game. I've tried using it myself by adjusting the code a bit, even after reloading and exiting the game, the mail box is empty again. How do I make the messages save using persistent data?


This will give you an opportunity to save persistent data.
When you exit and restart the program the data you have saved will be shown. If no data is saved you will get the message "postbox empty".

Code: Select all

label start:

    if not persistent.postbox:
        "postbox empty"
    else:
        $ pb=persistent.postbox
        "[pb]"


    $ pb= renpy.input("Enter text to postbox")
    $ persistent.postbox = pb
    $ renpy.save_persistent()

     pause
    return

Image Visual Story Telling, DeviantArt Group for animations, comics, games and illustrations https://www.deviantart.com/acgi

Post Reply

Who is online

Users browsing this forum: Donmai