Page 1 of 1

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

Posted: Sun Oct 05, 2014 1:07 pm
by ProxyPawaa
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.

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

Posted: Sun Oct 05, 2014 1:28 pm
by PyTom
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.

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

Posted: Sun Oct 05, 2014 1:35 pm
by ProxyPawaa
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?

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

Posted: Sun Oct 05, 2014 4:11 pm
by Alex
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()

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

Posted: Sun Oct 05, 2014 4:45 pm
by ProxyPawaa
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.

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

Posted: Sun Oct 05, 2014 5:03 pm
by Alex
$ 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.

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

Posted: Sun Oct 05, 2014 5:10 pm
by ProxyPawaa
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...

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

Posted: Sun Oct 05, 2014 5:24 pm
by Alex

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

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

Posted: Sun Oct 05, 2014 8:04 pm
by ProxyPawaa
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?

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

Posted: Mon Oct 06, 2014 2:12 pm
by Alex
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