Is it possible to make a label playable only once a day?
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.
Is it possible to make a label playable only once a day?
I created a "special menu" on my game.
I was thinking of adding an option (button) called like "Read Today's luck", something like this.
When you clicked, you would play a label that would show you a message.
Something like "It's a good day to send flowers to Anna." I'd make many different labels and the game choose them randomly, so there would be different messages.
That's easy to make.
The thing is: I wanted this label playble only once a day.
When you tried clicking there again, a message like "You've already read today's luck. Come back tomorrow." would appear.
Only in the next day, after midnight, the person you be able to read another "luck message" by clicking there.
It is possible to make on Renpy?
I don't remember reading about a code like this at all.
This is just something that came to my mind now.
ps: for a newbie, I always want to to difficult things. Sorry
Thanks.
I was thinking of adding an option (button) called like "Read Today's luck", something like this.
When you clicked, you would play a label that would show you a message.
Something like "It's a good day to send flowers to Anna." I'd make many different labels and the game choose them randomly, so there would be different messages.
That's easy to make.
The thing is: I wanted this label playble only once a day.
When you tried clicking there again, a message like "You've already read today's luck. Come back tomorrow." would appear.
Only in the next day, after midnight, the person you be able to read another "luck message" by clicking there.
It is possible to make on Renpy?
I don't remember reading about a code like this at all.
This is just something that came to my mind now.
ps: for a newbie, I always want to to difficult things. Sorry
Thanks.
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Is it possible to make a label playable only once a day?
I am assuming you mean in real time?
While I don't have time to write the code, I have an idea about the logic.
Create a screen with the python date time module.
Assign the current day, month and year to a variable when the screen is shown.
Make a button in that screen that checks the time variable, sets a different time variable then checks if the two variables are the same.
If they aren't, give the player their reward, and increment the day variable by one
I had a better idea, but since I am writing this during my free moments at work, I got busy and lost thought of it.
While I don't have time to write the code, I have an idea about the logic.
Create a screen with the python date time module.
Assign the current day, month and year to a variable when the screen is shown.
Make a button in that screen that checks the time variable, sets a different time variable then checks if the two variables are the same.
If they aren't, give the player their reward, and increment the day variable by one
I had a better idea, but since I am writing this during my free moments at work, I got busy and lost thought of it.
Last edited by Imperf3kt on Mon Jan 21, 2019 9:49 pm, edited 1 time in total.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- deltadidirac
- Regular
- Posts: 123
- Joined: Fri Nov 30, 2018 5:00 am
- Projects: Artworks and Comics
- Tumblr: deltadidirac
- Deviantart: Deltadidirac67
- Location: Europe
- Contact:
Re: Is it possible to make a label playable only once a day?
I'm completly new with renpy, but perhaps this example I create could give you an idea and you could write better than me.
general variable msg assignement:
variable day assignement:
example of the engine msg
in your system engine timer, you must write at the end and change of every day
this operation to reset the readluckval:
all this it's only a suggest, I'm sure all can be write better , perhaps using some screen and not labels
see you
general variable msg assignement:
Code: Select all
default readluckval = 0
Code: Select all
default dayval = 1 ##1= monday, 2= tuesday , ecc..
Code: Select all
label engine_luck:
if readluckval ==0 and dayval ==1:
jump yourmsgengine ### here you call your casual msg
elif readreadluckval ==1 and dayval ==1
jump messagereaded ### here you call you msg that you have already read the day msg
elif readluckval ==0 and dayval ==2:
jump yourmsgengine ### here you call your casual msg
elif readluckval ==1 and dayval ==2:
jump messagereaded ### here you call you msg that you have already read the day msg
elif ..... #### continue for all the 7 days
this operation to reset the readluckval:
Code: Select all
$ readluckval *=0
see you
Re: Is it possible to make a label playable only once a day?
Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Re: Is it possible to make a label playable only once a day?
Thank you SO much guys! I'll give it a try
-
- Regular
- Posts: 52
- Joined: Sun Jul 01, 2018 8:32 am
- Contact:
Re: Is it possible to make a label playable only once a day?
I'm not a pro but the simpliest thing I could think of if you DON'T want to make this depending on realtime, is you could simply add a variable that stores if the messages was read and reset it every day:
Code: Select all
if message_read==0:
"Lucky Message"
$ message_read = 1
else:
"You've already read today's luck. Come back tomorrow."
label next_day:
$ message_read = 0
Re: Is it possible to make a label playable only once a day?
I want to make it based on real time.recreation wrote: ↑Wed Jan 23, 2019 8:12 am I'm not a pro but the simpliest thing I could think of if you DON'T want to make this depending on realtime, is you could simply add a variable that stores if the messages was read and reset it every day:Code: Select all
if message_read==0: "Lucky Message" $ message_read = 1 else: "You've already read today's luck. Come back tomorrow." label next_day: $ message_read = 0
But I'm going to test this one too, to see what it would look like.
Thanks.
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot]