Grettings! I am not a frequenter on replying to people, but I think I might be-able to help some.
Since you mention DDLC, how about we use their code as an exact example. (Seeing how other people did things is such great reference!)
Code: Select all
$ chapter = 4
call ch4_main
python:
try: renpy.file(config.basedir + "/hxppy thxughts.png")
except: open(config.basedir + "/hxppy thxughts.png", "wb").write(renpy.file("hxppy thxughts.png").read())
I'm sure you know the hxppy thxughts.png that it creates, well this is how it is done. Now this is based on if ch4 is unlocked, and if you don't know DDLC structure it's quite intense, I suggest giving it a look.
Here is an example of how I used it
Code: Select all
python:
open(config.basedir + "/stolenrunez.png", "wb").write(renpy.file("stolenrunez.png").read())
persistent.hasrune == 1:
#temp jump so I don't have to actuall get trigger
jump ch1-main:
Basically it will create a stolenrunez.png on an image from the directory you put, and I have a persistent there for later use, which is also how they make un-changeable actions. So I could set persistent on if you said no to something and use it later as a lock etc. In the DDLC code there they also check for it, which is good practice.
Sorry that I didn't explain it too well, have never been good at that, however I think you can figure it out from that, if not you can wait for someone more skilled and better at explaining to reply, or send a direct message and I can go into more detail if you need.
:edit: I forgot to mention, renpy has a "File Access" post that is really useful for this stuff as well, give it a read!
https://www.renpy.org/doc/html/file_python.html