Ren'Py Help with functions (remove line output)

<JT>

Active Member
Game Developer
May 1, 2019
511
2,122
Hi guys!
Need help.
When the dialog starts, the time line gets in the way and I can't remove it.

Code:
init:

    init python:

        class TimeParametrs(object):

            def __init__(self, Minutes, Hours, Weekdays, Day):

                self.Minutes = Minutes

                self.Hours = Hours

                self.Weekdays = Weekdays

                self.Day = Day

            [USER=2111498]property[/USER]

            def Output(self):

                return self.Weekdays[self.Day] + " " + str(self.Hours).zfill(2) + ":" + str(self.Minutes).zfill(2) #Here is the place where                                                                                                                                                       the function returns a string

            def AddTime(self, Minutes):

                self.Minutes+=Minutes

                if self.Minutes>=60:

                    self.Hours+=1

                    self.Minutes=0

                if self.Hours>=24:

                    self.Day+=1

                    self.Hours=0

                if self.Day>=7:

                    self.Day=0

    class StatsParametrs():

            def __init__(self,bla1, bla2, bla3):

                self.Strength = bla1

                self.Handsome = bla2

                self.Reputation = bla3

            [USER=2111498]property[/USER]

            def OutputStatsParametrs(self):

                return str(self.bla1) + "     " + str(self.bla2) + "     " + str(self.bla3)

call Variables

    $ running = True

    while running:

        $ time_check()

        $ TimeParametrs.AddTime(15)

        $ TimeParametrs.Output           #  Here is a call to this line in a loop (how to remove it during a dialogue in any other block                                                                             of code?)

        $ OutputStatsParametrs = StatsParametrs.OutputStatsParametrs

    return



any block:



            "asdqw"

            "das"

            "das"

            "asdqw"

            "das"

            "das"

            "asdqw"

            "das"

            window hide

            $ Location = "Location any"

            return ("any")
If anyone can help I would be very grateful
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,135
14,818
When the dialog starts, the time line gets in the way and I can't remove it.
In the way of what ? Isn't it the purpose of a clock-like feature to permanently display the time ?


While I understand the Python part, what the hell this even mean ?
Code:
call Variables

    $ running = True
    while running:
        $ time_check()
        $ TimeParametrs.AddTime(15)
        $ TimeParametrs.Output           #  Here is a call to this line in a loop (how to remove it during a dialogue in any other block                                                                             of code?)
        $ OutputStatsParametrs = StatsParametrs.OutputStatsParametrs
    return

any block:

            "asdqw"
            "das"
            "das"
            "asdqw"
            "das"
            "das"
            "asdqw"
            "das"
            window hide
            $ Location = "Location any"
            return ("any")
The proper use for the Python code should be something like:
Python:
default inGameTime = TimeParametrs( [whatever starting date] )

screen UI():
    text "[inGameTime.Output]" xalign 0.1 yalign 0.0


label start:
    show screen UI
    [...]
    jump whatever

label whatever:
    "blabla"
    "blibli"
    $ inGameTime.AddTime(15)
    jump whateverNext

label whateverNext:
    "bloblo"
    "blublu"
    menu:
        "take a nap":
            $ inGameTime.AddTime(60)
        "don't":
            pass
    "blybly"
 
  • Like
Reactions: <JT>

<JT>

Active Member
Game Developer
May 1, 2019
511
2,122
In the way of what ? Isn't it the purpose of a clock-like feature to permanently display the time ?


While I understand the Python part, what the hell this even mean ?


The proper use for the Python code should be something like:
Python:
default inGameTime = TimeParametrs( [whatever starting date] )

screen UI():
    text "[inGameTime.Output]" xalign 0.1 yalign 0.0


label start:
    show screen UI
    [...]
    jump whatever

label whatever:
    "blabla"
    "blibli"
    $ inGameTime.AddTime(15)
    jump whateverNext

label whateverNext:
    "bloblo"
    "blublu"
    menu:
        "take a nap":
            $ inGameTime.AddTime(60)
        "don't":
            pass
    "blybly"
I am sorry. Last time I quickly made this post (poorly explained the problem). Probably you misunderstood me.
Code:
init:
    init python:
        class TimeParametrs(object):
            def __init__(self, Minutes, Hours, Weekdays, Day):
                self.Minutes = Minutes
                self.Hours = Hours
                self.Weekdays = Weekdays
                self.Day = Day
            @property
            def Output(self):
                return self.Weekdays[self.Day] + " " + str(self.Hours).zfill(2) + ":" + str(self.Minutes).zfill(2)
            def AddTime(self, Minutes):
                self.Minutes+=Minutes
                if self.Minutes>=60:
                    self.Hours+=1
                    self.Minutes=0
                if self.Hours>=24:
                    self.Day+=1
                    self.Hours=0
                if self.Day>=7:
                    self.Day=0
        
        class StatsParametrs():
            def __init__(self,Strength, Handsome, Reputation):
                self.Strength = Strength
                self.Handsome = Handsome
                self.Reputation = Reputation
            @property
            def OutputStatsParametrs(self):
                return str(self.Strength) + "     " + str(self.Handsome) + "     " + str(self.Reputation)
            def AddStatsParametrsStrength(self, Strength):
                self.Strength+=Strength
            def AddStatsParametrsHandsome(self, Handsome):
                self.Handsome+=Handsome
            def AddStatsParametrsReputation(self, Reputation):
                self.Reputation+=Reputation
efault Location="146464"
    
label start:
    
    call Variables
    $ gamerunning = True
    while gamerunning:
        $ time_check()
        $ TimeParametrs.AddTime(999999999)
        $ TimeParametrs.Output
        $ OutputStatsParametrs = StatsParametrs.OutputStatsParametrs
        $ OutputNaturalNeeds = NaturalNeeds.OutputNaturalNeeds
        if Location=="Home":
            if Time_morning or Time_day:
                scene black with dissolve
                show tyntyntyn
                call nmyty
            elif Time_night:
                scene black with dissolve
               
                show tyntyntyn
                call nmyty
                 
        if Location=="wevwe":
            beberbebe   
        if Location=="vewvewv":
            ebrerberberb
        if Location=="wevwev":
            rgberber
            $ Location = renpy.call_screen("wefwefwef")
        if Location=="City":
            $ Location = renpy.call_screen("weffwe")
        if Location == "wefwefwef":
            call wefwefw
        if Location == "wefwefwefw":
            call wefwefwef
    return
label ergkiuikerger:
    if Time_morning:
        scene black
        
    if Time_day:
        scene black
        
    if Time_night:
        scene black
        
    menu:
        "choice_1":#-------------------------This block, which is called in the main loop, should not display this - $ TimeParametrs.Output
            "das"#-----------------------------                                                                             but it kept showing up and never closed
            "asdqw"
            "das"
            "das"
            "asdqw"
            "das"
            "das"
            "asdqw"
            "das"
            window hide
            $ Location = "Bum_place_map"
            return ("Bum_place_map")
        "choice_2":
            "das"
            "asdqw"
            "das"
            "das"
            "asdqw"
            "das"
            "das"
            "asdqw"
            "das"
            
            window hide
            $ Location = "ebvererb"
            return ("wqcwqcq")



screen Any_Screen():
frame:
xalign 0.0
yalign 0.0
xsize 1920
ysize 1080
if Time_morning:
background "dqwdq"
add "wqdq"
if Time_day:
background "dqwq"
add "dqwdq"
if Time_night:
background "qwdqwd"
add "qwdqwd"
text "{font=Gagalin-Regular.otf}[TimeParametrs.Output]{/font}" size 40 color "#eeff00e5" xalign 0.5 yalign 0.01

$ TimeParametrs.Output - This should only be displayed on the screen where it is written, but it continued to be displayed even in any other label

I already found what was the problem and fixed it
In any case, thanks for the reply.

all the best