Well... one thing I can tell you for sure, it's not much like how they make it look in movies and games.
It depends on what kind of "fix" is required, really. When it comes to "fixing" the actual scenes and dialogue, that's not really coding and debugging
per se, so much as it is just applying English grammar, spelling, and creative-writing skills to (re)writing dialogue and descriptions, fixing spelling errors, putting punctuation in the right places, and so on. (Although I shouldn't really say "just" -- creative writing and English composition is a skill in itself, to be sure. But it's at least one that most people are exposed to in school, so it's hopefully not something that needs detailed explanation here.
)
Debugging the actual game logic, such as the ones above, is a little more complex. It generally starts with noticing that the game is doing something unexpected, or something which doesn't make any sense in terms of where you are in the game or what your character's current status (location, stats, time of day, etc.) is. Then you have to examime the code around that event to see
why the game is doing it.
In the case of the "you earned [RingsRan] rings" bug, it was actually fairly simple to see the cause. The [square brackets] surrounding RingsRan tells Ren'Py that it's supposed to "interpolate" whatever it finds between the brackets -- i.e. display the result of a calculation, or the current value of a variable, and so on. The fact that it was literally printing "[RingsRan]" told me that the RingsRan variable probably didn't exist in the code, or wasn't being set -- so, I used the editor's "find in Project" feature to see if RingsRan was anywhere to be found, and it wasn't (outside of that one message line, of course). Instead, there was a line
after the message, which caused the game to add a random value between 50 and 150 to your rings count:
Code:
x "You surf around Mobian List to find a good online programming job since saving the world isn't bringing in\
the bills anymore. Luckily there is plenty on this site and you find one that pays [RingsRan] rings."
x "It takes you about an hour to finish but once it's done, the rings are transferred to your account."
$ inv.earn(renpy.random.randint(50, 150))
So from there, the fix was simple. Bring that random-number generation up so it occurs
before the message is printed, and make sure it gets stored in a variable so that the value can be both printed in the message, and then added to the rings count:
Code:
$ iRingsRnd = renpy.random.randint(50, 150)
x "You surf around MobiusList to check the job listings, since saving the world just doesn't pay the bills like it used to. Luckily, there are plenty of part-time gigs available to help a hedgehog make ends meet, and you find one that pays [iRingsRnd] rings."
x "It takes you about an hour to finish. Once you submit the finished work back to the client, the rings are transferred to your account."
$ inv.earn(iRingsRnd)
More complex bugs require you to do more work to figure them out, especially if they're events that are only supposed to trigger under certain conditions (like the "Rouge knows too much" bug), because then you'll have to look for multiple variables and flags, and follow the execution paths through several different possible paths in the code to see what's going on. Ultimately, though, it mostly comes down to persistence, keeping notes, and remembering that computers are totally literal-minded and will only do exactly what you
tell them to do, not necessarily what you
wanted them to do.