One question... how would I make the pc recognize the specific day and the day of the week (Monday, Tuesday, etc.) and change things in the game. my idea are make a map and depending on the day and maybe hour (if I could fit it would be perfect but the main are the day of the week) the character will apper on that place.
I made a map with viewport and buttons it leads to a label. I wanted it when I entered this label to recognize the day and time (again the day are perfect) and take the other label (where if the character had it it would be played to another screen) and if it would not in the plae, receive a dialogue alone.
I already found something about specific days like xmas (and I think I intend to use this one for events and things like that, but only later) thats are possible
days of week in 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: 17
- Joined: Wed Jan 16, 2019 11:59 pm
- Contact:
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- 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-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: days of week in game
Look up the python module 'datetime'. For weekday you could do something like this.nautilus_nc wrote: ↑Mon May 06, 2019 2:15 pm One question... how would I make the pc recognize the specific day and the day of the week (Monday, Tuesday, etc.) and change things in the game. my idea are make a map and depending on the day and maybe hour (if I could fit it would be perfect but the main are the day of the week) the character will apper on that place.
I made a map with viewport and buttons it leads to a label. I wanted it when I entered this label to recognize the day and time (again the day are perfect) and take the other label (where if the character had it it would be played to another screen) and if it would not in the plae, receive a dialogue alone.
I already found something about specific days like xmas (and I think I intend to use this one for events and things like that, but only later) thats are possible
Code: Select all
init python:
from datetime import datetime
label start:
$ today=datetime.now()
$ iwday=datetime.date(today).weekday()
if iwday==0:
$ swday="monday"
elif iwday==1:
$ swday="tuesday"
elif iwday==2:
$ swday="wendsday"
elif iwday==3:
$ swday="thursday"
elif iwday==4:
$ swday="friday"
elif iwday==5:
$ swday="saturday"
elif iwday==6:
$ swday="sunday"
"Today is a [swday]."
-
- Newbie
- Posts: 17
- Joined: Wed Jan 16, 2019 11:59 pm
- Contact:
Re: days of week in game
Thanks, it worked apparently if I have any problems I'll return... you know what I can do about the hours? (let's say I think it's from 13pm to 18pm is late so I'd set it by the hour and the day (it's more complex for me but I can make)) who can i made ? ((like from 13pm to 15pm of monday he as on a place))
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- 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-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: days of week in game
In my code example the variable 'today' is loaded with date and time.nautilus_nc wrote: ↑Mon May 06, 2019 4:36 pm Thanks, it worked apparently if I have any problems I'll return... you know what I can do about the hours? (let's say I think it's from 13pm to 18pm is late so I'd set it by the hour and the day (it's more complex for me but I can make)) who can i made ? ((like from 13pm to 15pm of monday he as on a place))
If you add the code below to the earlier code, you can also see year, month, day, hour (24 hour/day) and minute. Everything as integers.
Second (and I think microsecond) is also possible.
Code: Select all
"The year is [today.year]."
"The month is [today.month]."
"The day is [today.day]."
"The hour is [today.hour]."
"The minute is [today.minute]"
jump start
-
- Newbie
- Posts: 17
- Joined: Wed Jan 16, 2019 11:59 pm
- Contact:
Re: days of week in game
Thank you they work
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], henne, Ocelot