Digital Clock; adding screen say: makes game not load text.

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
ProxyPawaa
Newbie
Posts: 23
Joined: Sun Jan 16, 2011 5:43 pm
Contact:

Digital Clock; adding screen say: makes game not load text.

#1 Post by ProxyPawaa » Sun Oct 05, 2014 1:07 pm

I attached a picture of the problem. I've added the coding available at:
http://www.renpy.org/wiki/renpy/doc/coo ... l_Calendar
to my code. When I ran it however after adding the

Code: Select all

screen say:
    if(clock):
        $ Calendar()
        $ Clocks()
part of the code, the game no longer loads and gives the error I have attached. I tried also adding the last part of the code to see if that was the issue that states

Code: Select all

$ minutes = minutes + 112#or whatever
And... well, nothing changed. I made a new .rpy file with the clock functions in the second code box there and pasted the variables it said to declare under label start: like it said, any idea what I did wrong?

On an unrelated issue, the ONE screen that isn't failing is when I request for the protagonist to be named. At that time, the clock displays low on the right side of the screen and is covered by the text box. Anyone mind helping me out on what x/y coordinates would be good to get it in the upper right to help me save some time?

Thanks.
Attachments
renpy.PNG

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#2 Post by PyTom » Sun Oct 05, 2014 1:28 pm

You redefined the say screen, which is used to display text. The definition you used is not a proper say screen, so you're getting these problems.

Although it's unrelated, 6.15 is ancient.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

ProxyPawaa
Newbie
Posts: 23
Joined: Sun Jan 16, 2011 5:43 pm
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#3 Post by ProxyPawaa » Sun Oct 05, 2014 1:35 pm

So the issue is that the cookbook recipe I used is horrifyingly out of date? Would it be better to remove the clock from my script entirely in favor of finding a different one, or is there a different code I can use to make it display?

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#4 Post by Alex » Sun Oct 05, 2014 4:11 pm

You need to remove this part

Code: Select all

screen say:
    if(clock):
        $ Calendar()
        $ Clocks()
from your start label.

Then, find the say screen in screens.rpy and add this lines inside this already existing screen.

Code: Select all

    if(clock):
        $ Calendar()
        $ Clocks()

ProxyPawaa
Newbie
Posts: 23
Joined: Sun Jan 16, 2011 5:43 pm
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#5 Post by ProxyPawaa » Sun Oct 05, 2014 4:45 pm

Is there any way I can have it activated at times and deactivated at others?

EDIT: Is there any way to make it not display the year? It seems to automatically detect the passing of time, so I don't know if it would have issues if I removed the coding referring to the year.
Last edited by ProxyPawaa on Sun Oct 05, 2014 5:04 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#6 Post by Alex » Sun Oct 05, 2014 5:03 pm

$ clock = True#make false to hide the calendar
Set the value of this variable to False to deactivate clock and calendar.
To move thing around the screen play with xalign and yalign values.

ProxyPawaa
Newbie
Posts: 23
Joined: Sun Jan 16, 2011 5:43 pm
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#7 Post by ProxyPawaa » Sun Oct 05, 2014 5:10 pm

So now I'm working on making the year not display...

Code: Select all

    def Calendar():
        ui.frame(xfill=False, xminimum = 400, yminimum=None, xalign=0.0, yalign = 0.0)
        ui.vbox()
        ui.text("(%s) - %s %d %d" % (stringweekday, stringmonth, theday, theyear), xalign=1.0, size=20)
        ui.close()
This seems to be where it decides what strings display and in what order. If possible, I'd like to replace theyear with the season in the game, but.... there's issues whether I replace it or remove it. I tried defining theseason in my script to Spring and then replacing 'theyear' with 'theseason' but it didn't seem to load, probably because the other definitions that the clock pulls from come from within my clock.rpy despite being initially defined in script.rpy

Any idea how to at least remove theyear safely? I'm fiddling with replacing it right now...

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#8 Post by Alex » Sun Oct 05, 2014 5:24 pm

Code: Select all

ui.text("(%s) - %s %d %d" % (stringweekday, stringmonth, theday, theyear), xalign=1.0, size=20)
This line is showing the info: %s means that a string value should be used here and %d means that the data value should be used; (stringweekday, stringmonth, theday, theyear) - the whole lot of variables which values will be used to fill in all those %s and %d (the order matters).

So, you can remove the year by changing the line

Code: Select all

ui.text("(%s) - %s %d" % (stringweekday, stringmonth, theday), xalign=1.0, size=20)
or change the year to a season (that is a string value, I assume)

Code: Select all

ui.text("(%s) - %s %d %s" % (stringweekday, stringmonth, theday, theseason), xalign=1.0, size=20)
https://docs.python.org/2/library/stdty ... operations

ProxyPawaa
Newbie
Posts: 23
Joined: Sun Jan 16, 2011 5:43 pm
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#9 Post by ProxyPawaa » Sun Oct 05, 2014 8:04 pm

Very informative. Thank you Alex. :)

I have one question though. Earlier the script wasn't recognizing things I used $ for instead of define before label start: yet the variables for the calender use this in the script. Does $ only work in the middle of the script for defining strings?

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Digital Clock; adding screen say: makes game not load te

#10 Post by Alex » Mon Oct 06, 2014 2:12 pm

Both the define statement and $-sign (that tells Ren'Py that this is the single-line python code) works fine. You can read about them here - http://www.renpy.org/doc/html/python.ht ... statement.
http://www.renpy.org/doc/html/quickstart.html#init
Also, you need to set the values for your variables after the game has begun to be able to save their values properly (it is better to make it right in the very beginning of the start label) - http://www.renpy.org/doc/html/save_load_rollback.html

Post Reply

Who is online

Users browsing this forum: Bing [Bot]