Tool Ren'Py UnRen.bat v1.0.11d - RPA Extractor, RPYC Decompiler, Console/Developer Menu Enabler

5.00 star(s) 8 Votes

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
Rename your calls in your mod; you can add an "m" to the end or something, just make sure each instance is unique.
@Maim Lain to expand on this, the documentation for "call" says:
If the optional from clause is present, it has the effect of including a label statement with the given name as the statement immediately following the call statement. An explicit label helps to ensure that saved games with return stacks can return to the proper place when loaded on a changed script.

You have this code at 250:
if not _in_replay:
call set_time ("morn") from _call_set_time_41

And this at 343:
if not _in_replay:
call set_time ("morn") from _call_set_time_41

Note that both from clauses define the same label. That's the problem.
 
  • Like
Reactions: Maid Lain and bas

Maid Lain

Well-Known Member
Modder
Game Developer
Apr 4, 2018
1,888
16,250
An explicit label helps to ensure that saved games with return stacks can return to the proper place when loaded on a changed script.
Thanks I was able to fix the mod but am still curious about this. Are you able to explain this part more? Why would changing the script require calls to have these?

And so do developers seriously have do _call_set_time_1, _call_set_time_2, _call_set_time_3, every single time they want to call a function? That sounds really dumb.
 

bas

retired
Respected User
Donor
Former Staff
May 6, 2017
3,987
30,351
Thanks I was able to fix the mod but am still curious about this. Are you able to explain this part more? Why would changing the script require calls to have these?

And so do developers seriously have do _call_set_time_1, _call_set_time_2, _call_set_time_3, every single time they want to call a function? That sounds really dumb.
It's so that rollback works. In normal code for an application or whatever, you don't need to be able to step back through and undo what each line of code does. But in a Ren'Py game, it keeps a list in order so you can go back each click/keystroke. So each time you call a function, it needs a unique reference to be able to return to you not just that spot in the code, but that exact place in your game progress if you rollback.

Using Unren makes these errors occur where they didn't before if you use Unren to either 1) enable rollback, or 2) enable the dev console because either option enabled makes the game check the code on startup to ensure it's compatible with rollback.
 
  • Like
Reactions: Maid Lain

Maid Lain

Well-Known Member
Modder
Game Developer
Apr 4, 2018
1,888
16,250
It's so that rollback works. In normal code for an application or whatever, you don't need to be able to step back through and undo what each line of code does. But in a Ren'Py game, it keeps a list in order so you can go back each click/keystroke. So each time you call a function, it needs a unique reference to be able to return to you not just that spot in the code, but that exact place in your game progress if you rollback.
That seems like something RenPy should be handling itself instead of making developers keep track of and write a unique id when calling functions. What happens if you don't do the "call from" syntax and just call a function and the player rolls back? Would they not be able to roll back to before the function was called?
 

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
That seems like something RenPy should be handling itself instead of making developers keep track of and write a unique id when calling functions. What happens if you don't do the "call from" syntax and just call a function and the player rolls back? Would they not be able to roll back to before the function was called?
Feel free to suggest that to Renpy Tom. As far as I know, he's not on F95zone.
 

Maid Lain

Well-Known Member
Modder
Game Developer
Apr 4, 2018
1,888
16,250
Feel free to suggest that to Renpy Tom. As far as I know, he's not on F95zone.
I feel like in the 10 or so years that RenPy has existed he would have thought about it eventually. So I feel that either there's a better way to do that that already exists or I'm totally misunderstanding the point of manually making unique labels for calls. I think there's probably something or related to this but I haven't read a lot about it.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,105
14,757
That seems like something RenPy should be handling itself instead of making developers keep track of and write a unique id when calling functions.
In fact the return label is not to know where it should return, but if it should return to the call node itself (when there's a label), or to the node right after it. I'm not really sure of the difference, both call/return and rollback works great without the label.
Anyway, you don't need to write them. When you build the distribution the SDK have an option which will add them for you.
 
  • Like
Reactions: Maid Lain

Maid Lain

Well-Known Member
Modder
Game Developer
Apr 4, 2018
1,888
16,250
In fact the return label is not to know where it should return, but if it should return to the call node itself (when there's a label), or to the node right after it. I'm not really sure of the difference, both call/return and rollback works great without the label.
Anyway, you don't need to write them. When you build the distribution the SDK have an option which will add them for you.
I'm not really sure what node means in your context. A statement or code block?
But thanks for the info that's good to know. It's a bit funny and sad that I've seen so many developers doing the "_call_my_function_483, _call_my_function_484, 485, etc" thing though. Mythic Manor, Harem Hotel, and Four Elements Trainer all do it lol.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,105
14,757
I'm not really sure what node means in your context. A statement or code block?
It can be one or the other, it depend what's around them and of the optimization. But basically a node is just an entry in the .


It's a bit funny and sad that I've seen so many developers doing the "_call_my_function_483, _call_my_function_484, 485, etc" thing though. Mythic Manor, Harem Hotel, and Four Elements Trainer all do it lol.
I'm sure that they don't do it themselves and just ask Ren'py to do it for them when it build the distribution file.
 
  • Like
Reactions: Maid Lain

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
It can be one or the other, it depend what's around them and of the optimization. But basically a node is just an entry in the .
And I never thought I'd see a reference to ASTs outside of work...woof! :coldsweat:
 

Maid Lain

Well-Known Member
Modder
Game Developer
Apr 4, 2018
1,888
16,250
I'm sure that they don't do it themselves and just ask Ren'py to do it for them when it build the distribution file.
When you said RenPy does it for you I thought you meant behind the scenes. RenPy editing the contents of the actual code files sounds as strange and horrible as developers adding the labels themselves. XD
Maybe I just don't know anything because that doesn't sound right to me either.


And I never thought I'd see a reference to ASTs outside of work...woof! :coldsweat:
Nah, we're talking about WASTs, not ASTs. Get your geeky ASTs out of here nerd! :p
lain.png
 

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
When you said RenPy does it for you I thought you meant behind the scenes. RenPy editing the contents of the actual code files sounds as strange and horrible as developers adding the labels themselves. XD
Maybe I just don't know anything because that doesn't sound right to me either.
In Ren'Py, go to "Build Distributions" and click "Add from clauses to calls". That's where Ren'Py does it for the author.
 
  • Like
Reactions: Maid Lain

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,105
14,757
When you said RenPy does it for you I thought you meant behind the scenes. RenPy editing the contents of the actual code files sounds as strange and horrible as developers adding the labels themselves. XD
Didn't you find it strange and disturbing that all the authors using the labeled call syntax used exactly the same naming convention for the label, while being like night and day for every single other names ?
 

Maid Lain

Well-Known Member
Modder
Game Developer
Apr 4, 2018
1,888
16,250
Didn't you find it strange and disturbing that all the authors using the labeled call syntax used exactly the same naming convention for the label, while being like night and day for every single other names ?
Well the Mythic Manor dev taught the Harem Hotel dev how to do a lot of things in RenPy and has even written a few functions in the HH code so it made sense why they used the same syntax since they also have similar naming conventions.
The coder for FET is really bad (like 400 lines of consecutive if statements becuz he doesn't know what a loop is level of bad), so manually labeling hundreds of calls seemed like an improvement compared to some of his other coding habits, so I figured he just followed the naming convention from wherever he learned it.


Well after hijacking 1/21th of this thread I don't think I have anymore questions so thanks everyone.
 

goobdoob

Conversation Conqueror
Modder
Respected User
Dec 17, 2017
7,425
9,680
Well the Mythic Manor dev taught the Harem Hotel dev how to do a lot of things in RenPy and has even written a few functions in the HH code so it made sense why they used the same syntax since they also have similar naming conventions.
The coder for FET is really bad (like 400 lines of consecutive if statements becuz he doesn't know what a loop is level of bad), so manually labeling hundreds of calls seemed like an improvement compared to some of his other coding habits, so I figured he just followed the naming convention from wherever he learned it.


Well after hijacking 1/21th of this thread I don't think I have anymore questions so thanks everyone.
What is FET?

And if you want to see bad code - Daddy's Goodnight Kiss. Woof. I think I got dumber figuring out how his code worked.
 
  • Like
Reactions: bas

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,105
14,757
What is FET?
I assumed "Four Element Trainer".


And if you want to see bad code - Daddy's Goodnight Kiss.
There's worse, way worse. I'll not name the game, but there's one with around 1600 "hide screen" for a total around 9600 lines of code ; almost 1 out of 5 line is a "hide screen". Most on block of 5 or more ; one goes up to 36 "hide screen" in a row. It officially became the worse I've seen.
If you are curious, search in my recent activity, I wrote twice on the thread last week, not on the same day...
 
5.00 star(s) 8 Votes