Calendar Editor

SeniGaming

Active Member
Game Developer
Sep 8, 2019
579
565
Hi!

I worked this agenda editing.
the agenda works well.
but as you can see in my code I want to allow players to modify this schedule.

In the last part of my code I managed to put the renpy input I wanted to put in, I didn't do it before because I didn't do it with vboxes, now, it works.

unfortunately I can't get out of this code to go back to my story in a correct way.

When I click on work to modify the sunday morning I can change free by what I want. But I can't go back to the calendar and close the screens previously opened.
The image of the calendar remains open and I find myself following my story without being able to return to the computer screen.
I've tried many methods to get out of this, but I can't.


Code:
label theevencalorbed:
    menu:
        "Work Computer.":
            call screen thecomputer
        "Go to bedroom.":
            return
    return

screen thecomputer():
    add "computer"
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01):
        action Return
    imagebutton auto "icon/foldcalen_%s.png" align (0.05, 0.25):
        action  Show("theelpicalendar")

screen theelpicalendar():
    add "elpithecal"
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01):
        action Hide("theelpicalendar")
    textbutton "Work" action Jump("modifcalen"):
        xalign 0.9
        yalign 0.9
    vbox:
        style_prefix "yourstatstyle"
        align(0.14, 0.20)
        text "[calsunmo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.27, 0.20)
        text "[calmonmo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.40, 0.20)
        text "[caltuemo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.53, 0.20)
        text "[calwedmo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.66, 0.20)
        text "[calthumo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.79, 0.20)
        text "[calfrimo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.92, 0.20)
        text "[calsatmo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.14, 0.40)
        text "[calsunaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.27, 0.40)
        text "[calmonaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.40, 0.40)
        text "[caltueaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.53, 0.40)
        text "[calwedaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.66, 0.40)
        text "[calthuaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.79, 0.40)
        text "[calfriaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.92, 0.40)
        text "[calsataf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.14, 0.60)
        text "[calsunla]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.27, 0.60)
        text "[calmonla]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.40, 0.60)
        text "[caltuela]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.53, 0.60)
        text "[calwedla]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.66, 0.60)
        text "[calthula]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.79, 0.60)
        text "[calfrila]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.92, 0.60)
        text "[calsatla]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.14, 0.80)
        text "[calsunev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.27, 0.80)
        text "[calmonev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.40, 0.80)
        text "[caltueev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.53, 0.80)
        text "[calwedev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.66, 0.80)
        text "[calthuev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.79, 0.80)
        text "[calfriev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.92, 0.80)
        text "[calsatev]"

default calsunmo = "Free"
default calmonmo = "Free"
default caltuemo = "Free"
default calwedmo = "Free"
default calthumo = "Free"
default calfrimo = "Free"
default calsatmo = "Free"
default calsunaf = "free"
default calmonaf = "Free"
default caltueaf = "Free"
default calwedaf = "Free"
default calthuaf = "Free"
default calfriaf = "Free"
default calsataf = "Free"
default calsunla = "free"
default calmonla = "Free"
default caltuela = "Free"
default calwedla = "Free"
default calthula = "Free"
default calfrila = "Free"
default calsatla = "Free"
default calsunev = "free"
default calmonev = "Free"
default caltueev = "Free"
default calwedev = "Free"
default calthuev = "Free"
default calfriev = "Free"
default calsatev = "Free"

label modifcalen:
    $ calsunmo =  renpy.input("Sunday Morning")
    $ calsunmo = calsunmo.strip()
    if not calsunmo:
        $ calsunmo = "Free"

I tried this code...:
Code:
label modifcalen:
    $ calsunmo =  renpy.input("Sunday Morning")
    $ calsunmo = calsunmo.strip()
    if not calsunmo:
        $ calsunmo = "Free"
with a screen or a label... I tried to finish it with a hide, return... or I tried to add an imagebutton to close it, I don't succeed.
every time I try to modify it, this code automatically opens as soon as I come to the agenda and I can no longer modify the text because it runs as a loop as if it automatically restarts uninterrupted and continuous.

Thanks for your help!
 

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,692
I'm going to dare to give you a possible solution, although I'm not sure and I can't prove it right now, hahaha

Try this:
Code:
label theevencalorbed:
    menu:
        "Work Computer.":
            show screen thecomputer   ### "show" instead of "call"
        "Go to bedroom.":
            return
    return

screen thecomputer():
    modal True  ### This prevents the player from clicking on other parts of the screen.
    add "computer"
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01) action Hide("thecomputer"
    imagebutton auto "icon/foldcalen_%s.png" align (0.05, 0.25) action Hide("thecomputer", Show("theelpicalendar")   ### Hide "thecomputer" and "theelpicalendar" shows.

screen theelpicalendar():
    modal True  ### This prevents the player from clicking on other parts of the screen.
    add "elpithecal"
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01) action Hide("theelpicalendar")
    textbutton "Work" action Call("modifcalen"):    ### You make a "call" to the label instead of "jump" to it.
        xalign 0.9
        yalign 0.9
    vbox:
        style_prefix "yourstatstyle"
        align(0.14, 0.20)
        text "[calsunmo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.27, 0.20)
        text "[calmonmo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.40, 0.20)
        text "[caltuemo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.53, 0.20)
        text "[calwedmo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.66, 0.20)
        text "[calthumo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.79, 0.20)
        text "[calfrimo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.92, 0.20)
        text "[calsatmo]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.14, 0.40)
        text "[calsunaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.27, 0.40)
        text "[calmonaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.40, 0.40)
        text "[caltueaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.53, 0.40)
        text "[calwedaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.66, 0.40)
        text "[calthuaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.79, 0.40)
        text "[calfriaf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.92, 0.40)
        text "[calsataf]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.14, 0.60)
        text "[calsunla]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.27, 0.60)
        text "[calmonla]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.40, 0.60)
        text "[caltuela]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.53, 0.60)
        text "[calwedla]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.66, 0.60)
        text "[calthula]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.79, 0.60)
        text "[calfrila]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.92, 0.60)
        text "[calsatla]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.14, 0.80)
        text "[calsunev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.27, 0.80)
        text "[calmonev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.40, 0.80)
        text "[caltueev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.53, 0.80)
        text "[calwedev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.66, 0.80)
        text "[calthuev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.79, 0.80)
        text "[calfriev]"
    vbox:
        style_prefix "yourstatstyle"
        align(0.92, 0.80)
        text "[calsatev]"

default calsunmo = "Free"
default calmonmo = "Free"
default caltuemo = "Free"
default calwedmo = "Free"
default calthumo = "Free"
default calfrimo = "Free"
default calsatmo = "Free"
default calsunaf = "free"
default calmonaf = "Free"
default caltueaf = "Free"
default calwedaf = "Free"
default calthuaf = "Free"
default calfriaf = "Free"
default calsataf = "Free"
default calsunla = "free"
default calmonla = "Free"
default caltuela = "Free"
default calwedla = "Free"
default calthula = "Free"
default calfrila = "Free"
default calsatla = "Free"
default calsunev = "free"
default calmonev = "Free"
default caltueev = "Free"
default calwedev = "Free"
default calthuev = "Free"
default calfriev = "Free"
default calsatev = "Free"

label modifcalen:
    $ calsunmo =  renpy.input("Sunday Morning")
    $ calsunmo = calsunmo.strip()
    if not calsunmo:
        $ calsunmo = "Free"
     return    ### You return to the "theelpicalendar" screen once you have made your changes.
 

the66

beware, the germans are cumming
Modder
Donor
Respected User
Jan 27, 2017
7,667
23,782
if you use in both screens the same tag you don't have to hide the 1st one when showing the second, the current screen is just replaced.
to use the input you have to start a 2nd interaction within your current interaction.
Python:
label theevencalorbed:
    menu:
        "Work Computer.":
            call screen thecomputer
        "Go to bedroom.":
            pass
    return

screen thecomputer():
    tag calendar  # <==
    add "computer"
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01):
        action Return()
    imagebutton auto "icon/foldcalen_%s.png" align (0.05, 0.25):
        action Show("theelpicalendar")

screen theelpicalendar():
    tag calendar  # <==
    add "elpithecal"
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01):
        action Return()
    textbutton "Work" action Function(renpy.call_in_new_context, "modifcalen"):  # <==
        xalign 0.9
        yalign 0.9
    .
    .
    .
    
label modifcalen:
    $ calsunmo =  renpy.input("Sunday Morning")
    $ calsunmo = calsunmo.strip()
    if not calsunmo:
        $ calsunmo = "Free"
    return
 

SeniGaming

Active Member
Game Developer
Sep 8, 2019
579
565
Wow, beautiful, guys, you guys are geniuses...
MSGomez always present, gracias parcejo, the66 always on time... thank you!

I'll bother you a little bit more...
When I click on work....
He puts me the image that was displayed during the choice of work computer or go to bed, it's a shame, it would be great if the image displayed remained the one of the calendar, because then the player can see that he works to modify the calendars....
if it's still too complicated to do then it's not important at all, the schedule works very well now and that's the main thing.

Thank you so much guys.

I have work to do to study all this to try to understand...

And I have another question, do you think it's possible to put the word work invisibly?
 
Last edited:

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,692
When I click on work....
He puts me the image that was displayed during the choice of work computer or go to bed, it's a shame, it would be great if the image displayed remained the one of the calendar, because then the player can see that he works to modify the calendars....
I think you just have to change this:
Code:
label theevencalorbed:
    menu:
        "Work Computer.":
            scene computer     ### The image that will be seen in the transition
            show screen thecomputer   ### "show" instead of "call"
        "Go to bedroom.":
            return




And I have another question, do you think it's possible to put the word work invisibly?
You can use the "color" property to make the text invisible:
Code:
{color=#0000ff00}Invisible Blue{/color}    ### The last two digits indicate the opacity; if I remember correctly "00" it is completely transparent (invisible), while "ff" is opaque.
NOTE: You may have to use "styles" on the buttons of the screens to apply that effect.
 
  • Like
Reactions: SeniGaming

SeniGaming

Active Member
Game Developer
Sep 8, 2019
579
565
I think you just have to change this:
Code:
label theevencalorbed:
    menu:
        "Work Computer.":
            scene computer     ### The image that will be seen in the transition
            show screen thecomputer   ### "show" instead of "call"
        "Go to bedroom.":
            return






You can use the "color" property to make the text invisible:
Code:
{color=#0000ff00}Invisible Blue{/color}    ### The last two digits indicate the opacity; if I remember correctly "00" it is completely transparent (invisible), while "ff" is opaque.
NOTE: You may have to use "styles" on the buttons of the screens to apply that effect.
Both problems are solved, thank you very much.

I want to know one last thing, this is not a problem, it's just a desire to know.
the66 often put return() in the code
I guess what () does after the return in this code, but I don't understand how.
I know the usefulness of () on screen and label but I didn't see the information on return()....

why ()... what do parentheses on return mean?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,268
Both problems are solved, thank you very much.

I want to know one last thing, this is not a problem, it's just a desire to know.
the66 often put return() in the code
I guess what () does after the return in this code, but I don't understand how.
I know the usefulness of () on screen and label but I didn't see the information on return()....

why ()... what do parentheses on return mean?
Yeah, it's something confusing. All the way through the writing of the code, you have to deal with two different syntax.

In the Ren'py grammar, () are used to convey parameters. Therefore, when there's no parameters, they can be ignored without consequences.

But in the Python grammar, () mean that you are "calling" the code represented by the name put before them. You can call it with parameters, but here it's the parameters that are optional, not the parentheses.
By example, open the console of Ren'py's SDK, and type renpy.version. You'll get an answer that will looks like "<function version at 0x0...>". You asked Python (via Ren'py) to show you the content of the attribute (variable) named "renpy.version", and this content is a function (therefore some code).
Now, still in the console, type renpy.version(). You'll get something that will looks like "Ren'Py 7.3.x.xyz". This time, you asked Python to execute the code stored in the attribute named "renpy.version".


And it become even more confusing when you have to face things like this :
Code:
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01):
        action Return
At first sigh, it seem correct according to both Ren'py's and Python's grammar. You are assigning to the action of this button, the code that will make the game return to where it was called. This while
Code:
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01):
        action Return()
seem to mean that you are directly executing this code before it is needed.

But the fact is that Ren'py add a level of abstraction in top of its grammar. Return do not store the code that will make the game return to where it was called, but the code that will create the code that will make the game return to where it was called (note, the underlining is here to clearly separate the two parts).

TL;DR: In case of doubt, always put the (). If Ren'py don't like it, it will tell it.
 

SeniGaming

Active Member
Game Developer
Sep 8, 2019
579
565
Yeah, it's something confusing. All the way through the writing of the code, you have to deal with two different syntax.

In the Ren'py grammar, () are used to convey parameters. Therefore, when there's no parameters, they can be ignored without consequences.

But in the Python grammar, () mean that you are "calling" the code represented by the name put before them. You can call it with parameters, but here it's the parameters that are optional, not the parentheses.
By example, open the console of Ren'py's SDK, and type renpy.version. You'll get an answer that will looks like "<function version at 0x0...>". You asked Python (via Ren'py) to show you the content of the attribute (variable) named "renpy.version", and this content is a function (therefore some code).
Now, still in the console, type renpy.version(). You'll get something that will looks like "Ren'Py 7.3.x.xyz". This time, you asked Python to execute the code stored in the attribute named "renpy.version".


And it become even more confusing when you have to face things like this :
Code:
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01):
        action Return
At first sigh, it seem correct according to both Ren'py's and Python's grammar. You are assigning to the action of this button, the code that will make the game return to where it was called. This while
Code:
    imagebutton auto "icon/buttonclose_%s.png" align (0.99, 0.01):
        action Return()
seem to mean that you are directly executing this code before it is needed.

But the fact is that Ren'py add a level of abstraction in top of its grammar. Return do not store the code that will make the game return to where it was called, but the code that will create the code that will make the game return to where it was called (note, the underlining is here to clearly separate the two parts).

TL;DR: In case of doubt, always put the (). If Ren'py don't like it, it will tell it.

I understood....
Thank you very much, Anne.

The last sentence reminds me of something, I always put them () on the call screen and I think it was already you who taught me how to do that.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,268
The last sentence reminds me of something, I always put them () on the call screen and I think it was already you who taught me how to do that.
I doubt that it was me, I have the bad habit to forget them :D
But well, it wouldn't be the first time that I would have gone on the "do what I say, not what I do" path.

This said, I'm glad that you understood. It's a tricky subject, and I wasn't sure that I explained it clearly enough.
 

SeniGaming

Active Member
Game Developer
Sep 8, 2019
579
565
Yes! you explained very well

you say...
*parameters that are optional, not the parentheses.*
this sentence is very clear and can alone answer my direct question and you have done more than answer my question you have explained the difference and nuance that can be made from python and renpy.

understanding and mastering are two things that can be very different.
To make it easier for me to understand you could have chosen the example used in my code but to take renpy.version allowed me to test and see for myself another option of what I can do with parentheses and especially to make the link between the renpy.* something* and the return()

an explanation and an example that I can test, it's a perfect explanation.