• To improve security, we will soon start forcing password resets for any account that uses a weak password on the next login. If you have a weak password or a defunct email, please update it now to prevent future disruption.

Does anyone know why this isn't showing up?

CherryPopKelo

Newbie
Game Developer
Feb 9, 2020
92
344
So iv'e been having alot of issues trying to design a week system gor my game and after a while i googled one and followed the tutorial only to rin into even worse problems (Luckely I backed up my script otherwise it would be gone),

The problem here is the script is fine (Im pretty sure) but i cant get it to show up in the game, I have gamerunning set to default but have no idea why its not working.

The money display is working so i dont understand why this isn't.
2020-07-21 (7).png
 

scrumbles

Engaged Member
Jan 12, 2019
2,265
2,315
I think the while statement is skipped because of the code indentation.
label variables: is empty. So the game executes the line below, call clock, and goes to line 506.
label clock: is empty too and it doesn't have a return statement, so the game can't go back, but executes line 507.

Two minor things:
- line 502 should be $ day += 1 (I think the current line doesn't actually increment the value of day);
- the while block looks like an infinite loop to me. If gamerunning is always True, how do you end the loop?
 

CherryPopKelo

Newbie
Game Developer
Feb 9, 2020
92
344
I think the while statement is skipped because of the code indentation.
label variables: is empty. So the game executes the line below, call clock, and goes to line 506.
label clock: is empty too and it doesn't have a return statement, so the game can't go back, but executes line 507.

Two minor things:
- line 502 should be $ day += 1 (I think the current line doesn't actually increment the value of day);
- the while block looks like an infinite loop to me. If gamerunning is always True, how do you end the loop?

The loop? is that the error that comes up saying that my code is going to have an infinte loop in it? i couldnt figure that bit out so i hope that's what you mean XD Ill go update it now.
 

CherryPopKelo

Newbie
Game Developer
Feb 9, 2020
92
344
I think the while statement is skipped because of the code indentation.
label variables: is empty. So the game executes the line below, call clock, and goes to line 506.
label clock: is empty too and it doesn't have a return statement, so the game can't go back, but executes line 507.

Two minor things:
- line 502 should be $ day += 1 (I think the current line doesn't actually increment the value of day);
- the while block looks like an infinite loop to me. If gamerunning is always True, how do you end the loop?

How would you phase it? I'm still new to renpy and what you said as alippt confusing in places
 

SLDR

Uploader
Modder
Aug 5, 2016
202
1,151
Is it crashing? It should be, because you're calling day[day] which doesn't make sense because day is a list object, not an integer. And there's another typo in str(hour).zfill(2), you've written zfiil.

The indentation isn't a problem, it's just not what Python code usually looks like.

EDIT: To clarify, there should be an integer or a variable that represents an integer in the brackets, like day[0]. Create another variable to keep track of the day in terms of numbers from 0-6 and when you want the name of the day, use day[dayNum].
 
Last edited:

CherryPopKelo

Newbie
Game Developer
Feb 9, 2020
92
344
Is it crashing? It should be, because you're calling day[day] which doesn't make sense because day is a list object, not an integer. And there's another typo in str(hour).zfill(2), you've written zfiil

The indentation isn't a problem, it's just not what Python code usually looks like.

Im still getting used to the way renpy works, its actually easy to understand renpy coding and i solve most of the problems i have by what i learned and the error screen but but this one has been confusing me.

Thank you for the typo

With the day[day] code should i just have [day]? i was just following a tutorial and tried to remove all the stuff i didnt need like months and dates
 

SLDR

Uploader
Modder
Aug 5, 2016
202
1,151
Im still getting used to the way renpy works, its actually easy to understand renpy coding and i solve most of the problems i have by what i learned and the error screen but but this one has been confusing me.

Thank you for the typo

With the day[day] code should i just have [day]? i was just following a tutorial and tried to remove all the stuff i didnt need like months and dates
Check my edit. You need an integer inside the brackets to reference an item from the list. For example, day[0] = "Monday", day[6] = "Sunday", etc.
 

CherryPopKelo

Newbie
Game Developer
Feb 9, 2020
92
344
Check my edit. You need an integer inside the brackets to reference an item from the list. For example, day[0] = "Monday", day[6] = "Sunday", etc.
How would i go about coding that? Until i have done it i dont understand it
 

SLDR

Uploader
Modder
Aug 5, 2016
202
1,151
How would i go about coding that? Until i have done it i dont understand it
I took a closer look at your code and see that you use the day variable in lines 503-504 the way I'm telling you to. I recommend something like this:
1595380180872.png
 
Last edited:

CherryPopKelo

Newbie
Game Developer
Feb 9, 2020
92
344
Thank you, I will not know if it worked until i get it working in the top left of renpy (right screen where it says output)
View attachment 740186 View attachment 740187
Note that in bottom picture i changed the

frame:
xpos 0 ypos 0
xminimum 1920
yminimum 75
ymaximum 75
hbox:
text "[output]" xalign 0
text " "
text "[Money]" xalign 0

[output] to lover case and it is still not showing up
 

CherryPopKelo

Newbie
Game Developer
Feb 9, 2020
92
344
Try adding:
Code:
define output = "Monday"
right above where you have Money defined.
Yes now it just displays money monday and i wrote some code to advance the day and time and addid it to a menu but it still shows money meaning its not showing the output codde

$ day += 1 <---- im pretty sure that correct
 

SLDR

Uploader
Modder
Aug 5, 2016
202
1,151
It now shows up as Monday but does not show the time
So here's the problem: You're trying to use variables before you've defined them. Renpy reads code one line at a time and it goes in order from top to bottom. If you want to display the day and time instantly after starting a new game, you need to define the day and time before the game starts.

What you can do is move this code:
output = day_name[day] + " " + str(hour).zfill(2) + ":" + str(minute).zfill(2)
to where you define output so it looks like this:
define output = day_name[day] + " " + str(hour).zfill(2) + ":" + str(minute).zfill(2)

If you try to run the game now, it will crash because all of those variables you want to reference (day_name, day, hour, minute) have not been defined yet. You can fix this by defining all of those variables BEFORE you define output:
define day_name = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
define day = 0
define hour = 12
define minute = 0
define output = day_name[day] + " " + str(hour).zfill(2) + ":" + str(minute).zfill(2)


Or if you just want a quick fix, define output as whatever you want it to say right when the game starts and leave the rest of the code alone:
define output = "Monday 10:00"
 

CherryPopKelo

Newbie
Game Developer
Feb 9, 2020
92
344
create a new project and slap this code into it then run the game.

This i what i wanted to happen but only change time when traveling between locations and doing actions however when i tried putting it in my game i got an infinite loop and it corrupded my game file while i was trying to figure out how to make it work.

i have no idea how to make it compatible with my game tho and nothing else seems to be working.


label start:
call variables
$ GameRunning = True
while GameRunning:
$ Output = WeekDays[Day] + " " + Months[Month] + " " + str(Days+1) + " " + str(Hours).zfill(2) + ":" + str(Minutes).zfill(2)

"[Output]"

$ Minutes += 30
if Minutes > 30:
$ Minutes = 0
$ Hours += 1
if Hours > 23:
$ Hours = 0
$ Day += 1
$ Days += 1
if Day > 6:
$ Day = 0
if Days > MonthDays[Month]:
$ Month += 1
$ Days = 0
if Month > 11:
$ Month = 0

label variables:
$ WeekDays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
$ Months = ["Jan", "Feb", "Mar", "Apr", "Man", "Jun", "July", "Aug", "Sep", "Oct", "Nov", "Dec"]
$ MonthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
$ Minutes = 0
$ Hours = 0
$ Month = 0
$ Day = 0
$ Days = 0




Now open up the screens coding and slap this in line 100

frame:
xpos 0 ypos 0
xminimum 1920
yminimum 75
ymaximum 75
hbox:
text "[date]" xalign 0
text " "
text "[Money]" xalign 0

This will give you the affect i wanted.