Ren py candelar

s2smakinesi

New Member
Jul 16, 2020
4
0
I'm trying to make a candelar for my game but I can't do it. I want to show image for days and times(like milfy city). But I can't do list for images and period. Have you any suggestions for me or example code. I wrote my code down but I'm new in Ren Py :(
Code:
#candelar.rpy file
label period:
    $ period = {"show morning", "show Afternoon", "show Evening", "show Night"}
    default period = 0
    default maxperiod = 3
    jump periodchange

label periodchange:
    $ period += 1
    if period >= maxperiod:
        $ period = 0
    return
#script file
label start:
    jump period
label olay1:
    if period ==0 eventgirl2 == 2:
        "event"
    else:
        "not event"
    call periodchange
    jump after
label after:
    "finish"
    return
 
Last edited:

Madmanator99

Member
May 1, 2018
225
466
Ok, I notice that you are somehow mixing the period counter, with the period list.
The counter changes as the day progresses, but the list does not change, it is only accessed for the value corresponding to the current period. So they need to be distinct one from another.

Maybe something like this:
Python:
#define your default list and period counter separatly outside of a label:
default periodlist = ("show Morning", "show Afternoon", "show Evening", "show Night") #the list.
default period = 0 #the counter.

#do your period counter changes in your labels.
...

#then to access the string "show xxx" based on the period counter value:
periodlist[(period%4)]
#you could add a third variable to shorten this, say a perioddisplay (or perioddsp for exemple),
#and make it = periodlist[(period%4)]  after each period counter update, then use that instead to show the image .
You could also try a ConditionSwitch to set your pictures, and the condition would be the period counter. You won't need a period list in this case.

Something like this:
Python:
#define the pictures for each period counter value outside of a label:
image yourscene = ConditionSwitch(
"period == 0", "yourscene_morning.png",
"period == 1", "yourscene_afternoon.png",
"period == 2", "yourscene_evening.png",
"period == 3", "yourscene_night.png",)

#then to show the image:
show yourscene[period] #that will diplay the picture that corresponds to the value of period
There may be better ways.
 
Last edited:
  • Like
Reactions: s2smakinesi

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
It isn't really clear to me what the problem is you are having.

Are you struggling with the variables and logic needed to do a calendar?
Or are you struggling with how to actually show that on the screen?

Here's some code I wrote a while ago as an example of one way to deal with a daily/period cycle. I don't think it's what you are looking for, but it does overlap somewhat with you example code... so perhaps it will help.
https://f95zone.to/threads/renpy-time-advance-issue.35438/post-2695277

If you are having problems displaying stuff though... That's usually a . In the case of a calendar box, usually displayed using . It could be a screen of its own or part of a large navigation/UI screen. Beyond that, it's difficult to say. Personally, for me, that screen would have some sort of background image which looks like a calendar icon, a text element with the day number as a large number aligned centrally within the calendar icon background, another smaller bit of text either above or below the number (probably in bold) with the shortened version of the day's name (Mon/Tue/Wed/etc). If you're doing a "real" calendar, maybe the name of the month too (again text). Then either more text saying "Morning/Afternoon/etc" or vary the background calendar image to include some variation on a sun/moon symbol.

The possibilities are endless, and therefore somewhat difficult to guess what solution might be the one you're looking for.

It would be better in the long term if you can figure the solution out for yourself - as you'll need to have at least a basic understanding of it if something ever goes wrong or as you use it more and more within your game.
 
  • Like
Reactions: s2smakinesi

s2smakinesi

New Member
Jul 16, 2020
4
0
Ok, I notice that you are somehow mixing the period counter, with the period list.
The counter changes as the day progresses, but the list does not change, it is only accessed for the value corresponding to the current period. So they need to be distinct one from another.

Maybe something like this:
Python:
#define your default list and period counter separatly outside of a label:
default periodlist = ("show Morning", "show Afternoon", "show Evening", "show Night") #the list.
default period = 0 #the counter.

#do your period counter changes in your labels.
...

#then to access the string "show xxx" based on the period counter value:
periodlist[(period%4)]
#you could add a third variable to shorten this, say a perioddisplay (or perioddsp for exemple),
#and make it = periodlist[(period%4)]  after each period counter update, then use that instead to show the image .
You could also try a ConditionSwitch to set your pictures, and the condition would be the period counter. You won't need a period list in this case.

Something like this:
Python:
#define the pictures for each period counter value outside of a label:
image yourscene = ConditionSwitch(
"period == 0", "yourscene_morning.png",
"period == 1", "yourscene_afternoon.png",
"period == 2", "yourscene_evening.png",
"period == 3", "yourscene_night.png",)

#then to show the image:
show yourscene[period] #that will diplay the picture that corresponds to the value of period
There may be better ways.
thank you It's very useful