Help Creating Files that appear at specific parts of the game.
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.
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.
-
- Newbie
- Posts: 20
- Joined: Thu Nov 13, 2014 12:56 am
- Projects: Legend Of Quadopolia
- Deviantart: Tagumonman55
- Contact:
Help Creating Files that appear at specific parts of the game.
So, similar to that in One Shot and DDLC, I want to be able to have the game reveal or create a Text file or image file in the game's folder ONLY DURING a certain part of the game....
I'm not sure how to do this exactly. Does anyone know?
I'm not sure how to do this exactly. Does anyone know?
- ChocolateMilk555
- Newbie
- Posts: 2
- Joined: Thu Jul 13, 2017 5:48 pm
- Contact:
Re: Help Creating Files that appear at specific parts of the game.
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!)
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
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
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())
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:
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
-
- Newbie
- Posts: 20
- Joined: Thu Nov 13, 2014 12:56 am
- Projects: Legend Of Quadopolia
- Deviantart: Tagumonman55
- Contact:
Re: Help Creating Files that appear at specific parts of the game.
Thank you for the help! It makes a lot more sense now!
But, Is there a way to remove the newly-revealed image after the player progresses past a certain point...? (ie: The same way DDLC makes the "hxppy thxughts.png" disappear from the directory AFTER that specific Sayori scene ends; regardless of whether the player viewed it or not.)
I'm sorry if these questions can easily be answered by looking in DDLC's Script... I'm not sure how to translate the script of DDLC to look at it myself.
But, Is there a way to remove the newly-revealed image after the player progresses past a certain point...? (ie: The same way DDLC makes the "hxppy thxughts.png" disappear from the directory AFTER that specific Sayori scene ends; regardless of whether the player viewed it or not.)
I'm sorry if these questions can easily be answered by looking in DDLC's Script... I'm not sure how to translate the script of DDLC to look at it myself.
- ChocolateMilk555
- Newbie
- Posts: 2
- Joined: Thu Jul 13, 2017 5:48 pm
- Contact:
Re: Help Creating Files that appear at specific parts of the game.
Sorry for my very late reply!Tagumonman55 wrote: ↑Thu Feb 01, 2018 5:07 pm Thank you for the help! It makes a lot more sense now!
But, Is there a way to remove the newly-revealed image after the player progresses past a certain point...? (ie: The same way DDLC makes the "hxppy thxughts.png" disappear from the directory AFTER that specific Sayori scene ends; regardless of whether the player viewed it or not.)
I'm sorry if these questions can easily be answered by looking in DDLC's Script... I'm not sure how to translate the script of DDLC to look at it myself.
Should have checked up again on this, there are many ways to do that. In DDLC they do a check.
Code: Select all
try: os.remove(config.basedir + "/hxppy thxughts.png")
There are also many ways to delete said thing differently, I honestly suggest you take a quick python course, a free one, it will help tremendously! Would love to see your game one day.
I won't give an exact line of code to delete it since it wouldn't work in that situation unless you are doing exactly what they are doing, however seeing that you should get what it is doing, and if you take that free python course, your bounds will be released.
-
- Regular
- Posts: 93
- Joined: Mon Dec 30, 2013 1:55 am
- Projects: Project Bluefield - Origins
- Organization: Autumn Rain
- Deviantart: playerzero17
- itch: autumn-rain
- Contact:
Re: Help Creating Files that appear at specific parts of the game.
Where the heck do you put this line, though? When I tried it, I got an error.Code: Select all
try: os.remove(config.basedir + "/hxppy thxughts.png")
- TsukiWorks
- Regular
- Posts: 27
- Joined: Sat Jun 23, 2018 6:50 am
- Projects: The Misunderstood
- Deviantart: TsukiWorks
- Contact:
Re: Help Creating Files that appear at specific parts of the game.
You should add "python":017Bluefield wrote: ↑Tue Sep 04, 2018 12:10 amWhere the heck do you put this line, though? When I tried it, I got an error.Code: Select all
try: os.remove(config.basedir + "/hxppy thxughts.png")
Code: Select all
python:
try: os.remove(config.basedir + "/hxppy thxughts.png")
-
- Newbie
- Posts: 13
- Joined: Thu Oct 15, 2020 9:59 am
- Soundcloud: DivinePlane
- Contact:
Re: Help Creating Files that appear at specific parts of the game.
I tried this and it works, but displays an error message, do you know why?ChocolateMilk555 wrote: ↑Thu Jan 25, 2018 10:17 pmCode: 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())
Who is online
Users browsing this forum: No registered users