Ren'Py Help with renpy/python

el69

Member
Oct 1, 2017
150
86
Hi, I'm trying to do a function in renpy which passes the time when you click on a sofa (like all games) and I don't know why it doesn't work.
If someone can help me I would be so grateful.
here I post the caps.
1599225187469.png
 

EnsenL

Newbie
Jun 10, 2017
28
34
You are calling the function without an argument, the daytime in this case. Try putting a 0 where you are calling the function.

timepass(0)

As a side note, the official renpy discord would be a much better place to ask for help if you need it. :)
 

el69

Member
Oct 1, 2017
150
86
You are calling the function without an argument, the daytime in this case. Try putting a 0 where you are calling the function.

timepass(0)

As a side note, the official renpy discord would be a much better place to ask for help if you need it. :)
I try it but nothing :/
And TY where is it that discord? can u send my the link?^^
1599301736344.png
 

the66

beware, the germans are cumming
Modder
Respected User
Donor
Jan 27, 2017
7,551
23,372
Python:
init python:
    daytime = 0

    def timepass():
        store.daytime += 1
        if daytime == 4:
            store.daytime = 0

screen blabla():
    whatever... action [timepass, Jump("Livingroom")]
you need no arguments for the timepass function, and so you can use it as action without the Function() screen action.
if you need to pass arguments within the Function() screen action, you pass them as kwargs Function(yourFunction, arg1="123").
 
  • Like
Reactions: el69

el69

Member
Oct 1, 2017
150
86
Python:
init python:
    daytime = 0

    def timepass():
        store.daytime += 1
        if daytime == 4:
            store.daytime = 0

screen blabla():
    whatever... action [timepass, Jump("Livingroom")]
you need no arguments for the timepass function, and so you can use it as action without the Function() screen action.
if you need to pass arguments within the Function() screen action, you pass them as kwargs Function(yourFunction, arg1="123").
ty it works!!!
 

the66

beware, the germans are cumming
Modder
Respected User
Donor
Jan 27, 2017
7,551
23,372
small addendum.
if you use a function directly as screen action and you don't leave the screen, you have to add renpy.restart_interaction() to your function, if said screen is affected by any changes made by the function.
 
  • Like
Reactions: el69

el69

Member
Oct 1, 2017
150
86
small addendum.
if you use a function directly as screen action and you don't leave the screen, you have to add renpy.restart_interaction() to your function, if said screen is affected by any changes made by the function.
Ty but i think in this case i dont need it, bc i program the label with all the values of daytime.
I mean.
Label livingroom:
If daytime == 1:
Call screen sclivingroommorning
If daytime ==2:
Call screen sclivingroomafternoon