Ren'Py How to make a loop?

Creator13

Starting developer
Game Developer
Jul 26, 2023
58
25
I was looking on some tutorials on YT and lemma, but how to put them together to work? If they are in separate label, it will never work at once, right?
 
Last edited:

basnalex

New Member
Jan 29, 2018
12
7
The jump morning statement is skipping all the other labels and then the return at the end moves it off the stack and may end the game. You probably are needing all Calls or make sure things jump back to the main game loop and it decides where to go next.
 
  • Like
Reactions: Creator13

Creator13

Starting developer
Game Developer
Jul 26, 2023
58
25
Thank you for reply. That I am getting (and best is probably "call mainloop" and not morning :)"...but...I would like to see scrip how it should be bound together. I was looking on lemma, but I see just pieces... And I am not sure how it should be connected together. I also see video from Uncle Mugen but as I don´t know much, I am little bit lost in it.
I want my next game have this, because just making next and next pictures is time taking, it is taking space and it didn´t helping game feeling, or RPG feeling.
 
Last edited:

Creator13

Starting developer
Game Developer
Jul 26, 2023
58
25
Soo..I tried it with your suggestion and some study on internet and now I have some morning to night loop. I have display, but..for some reason. I have only Tuesday?? :D
Any idea? Thx
 

basnalex

New Member
Jan 29, 2018
12
7
My guess would be you are setting the dayofweeknumber + 1 in the morning label. That means when day changes it is equal to 2 and then when it jumps to morning it changes to 3. It should be updated to 3 before you get to the daychange if/elif block.
 
  • Like
Reactions: Creator13

Creator13

Starting developer
Game Developer
Jul 26, 2023
58
25
Thank you. The issue was that at the end i should "call" for day change. Now, I have another one :)
So, I have some basic loop from morning to night, I have day of week, but...as I tried to put some use of it, I have errors. I am not sure what is wrong. Why "if" is not purple/not working :O
I use it previously without issue. But also...previously i wasn´t referring to day/night/week cycle...so..maybe it is not working same way :(
 

Creator13

Starting developer
Game Developer
Jul 26, 2023
58
25
OK, I figured how to correct it, so RenPy will not write syntax error. BUT...it is "working" - meaning...not working because it don´t give a f*ck what day is or how much points ...it show all options of menu. :-/
 

basnalex

New Member
Jan 29, 2018
12
7
I am not sure on this one. if I was coding it, I would probably print those variables out in my menu or right before it and then compare that to what I think it should be. Most of the time it is an off by one or not resetting a variable after leaving another label.
 

peterppp

Active Member
Mar 5, 2020
513
927
OK, I figured how to correct it, so RenPy will not write syntax error. BUT...it is "working" - meaning...not working because it don´t give a f*ck what day is or how much points ...it show all options of menu. :-/
you're having a bunch of and and or which looks wrong for two reasons, assuming renpy works as programming languages usually do.
1) you can't do if dayofweeknumber==1 or 3 or 5 because or 3 does not connect to dayofweeknumber. i'm guessing it will likely be interpreted as a true value, so always true. you have to do for instance if dayofweeknumber==1 or dayofweeknumber==3 or dayofweeknumber==5
2) you must use parantheses to define the logical interpretation of all the and/or. something like this:
if action==4 and (dayofweeknumber==1 or dayofweeknumber==3 or dayofweeknumber==5) and ...
 

Creator13

Starting developer
Game Developer
Jul 26, 2023
58
25
That I still need to figured out..I am not sure what to use. Maybe the bracket...I don´t know how to look this up in lemma or renpy wiki etc.
The main problem with loop...I solved it with change of design. I know that I had to write 30line of code where others could use something with only three lines-but now it is working. Just all connection have go go through one main location (maincoridor) and that is set to "call" dayofweek and timeofday (which are calculating time and days) so it returned Mo, Tu, We... / Mor, Noon, Afternoon... It is not elegant, but since I didn´t have enough knowledge to create better..it is enought.