- Jun 10, 2017
- 10,969
- 16,222
Hi,
Like you perhaps know, debugging a game relying on called label can be really hard.
How many label have I called to get here ? How many time still have I to return ? And if you add jump in this, you can easily end totally in your code. So, I wrote a small tool to help you (and in fact also me) with this.
It's really a small tool, 117 lines only, and it really do the minimal. But it do it well.
Some technical details are needed:
Firstly, Ren'Py have two modes when entering a label, one of them being said as "abnormal".
A label entering will be seen as abnormal when it's an implicit jump, or when it return from a
Note that from the tool, abnormal labels will be displayed in red, while normal labels will be displayed on green. This can help you quickly find that you forgot something.
Secondly, there's no simple way to know when you returned from a label.
Therefore, for the log file, I cheated. Every 1/20th of second I check if the game came back to a previous stack level. If it happen, this mean that the game returned, so the tool will log it.
Be warned that this mean that some
Thirdly, it's a quick tool.
It's designed to help you have a better view of the code flow, but it don't replace a careful approach of your code.
Plus, the code is designed to works, not to looks good, nor is it really optimized. It's a helper more than anything else.
Like you perhaps know, debugging a game relying on called label can be really hard.
How many label have I called to get here ? How many time still have I to return ? And if you add jump in this, you can easily end totally in your code. So, I wrote a small tool to help you (and in fact also me) with this.
It's really a small tool, 117 lines only, and it really do the minimal. But it do it well.
- It will constantly display the name of the current label, as well as the call stack depth on the top of the screen, helping you know where exactly you are, and how many labels you called to get there.
- If the label have effectively be called, you'll know in what file and at what line is the line that called it.
- If you hover the "depth" word (see screenshot) it will display all the labels at each stack level. This will help you have a more precise view, telling you not only where you are, but also how you got there.
- It will log in a file named "logFile.txt" every time you enter a label, and every time you returned from a label. What can help you to have a view of your code behavior over a longer run.
Some technical details are needed:
Firstly, Ren'Py have two modes when entering a label, one of them being said as "abnormal".
A label entering will be seen as abnormal when it's an implicit jump, or when it return from a
call someLabel from someFromLabel
. In this last case, Ren'Py will act as if you entered a new label, but the tracker will continue to display the name defined in the label whatever
line ; therefore the name of the label as you know it.Note that from the tool, abnormal labels will be displayed in red, while normal labels will be displayed on green. This can help you quickly find that you forgot something.
You don't have permission to view the spoiler content.
Log in or register now.
Secondly, there's no simple way to know when you returned from a label.
Therefore, for the log file, I cheated. Every 1/20th of second I check if the game came back to a previous stack level. If it happen, this mean that the game returned, so the tool will log it.
Be warned that this mean that some
return
statement can be not logged, because happening too fast. But the log include the current depth, so you'll not be totally lost.Thirdly, it's a quick tool.
It's designed to help you have a better view of the code flow, but it don't replace a careful approach of your code.
Plus, the code is designed to works, not to looks good, nor is it really optimized. It's a helper more than anything else.
Download: tool
You don't have permission to view the spoiler content.
Log in or register now.
Last edited: