- Pokémon Essentials Version
- Non-applicable
When you work with computers, things tend to go wrong. A lot. But it's not the end of the world. Here's how to handle those situations!
Note: I'm used to using languages other than Ruby (namely Game Maker, Java and Python) so I don't go super in-depth about anything related to RPG Maker here, but this should be enough information to get you started when it comes to dealing with and eliminating those annoying error messages.
Syntax Errors
Let's have a look at what's probably the easiest error to debug, the Syntax Error.
All right, that tells us . . . something. Let's open up the script named PSystem_Utilities and scroll down to line 518.
Cool, that's . . . code. And lo and behold, if you look at the area around line 518, there's some funny business going on.
Urgh, that's probably not supposed to be there. You can do a few things there, like placing an expression on the right side of the equals sign or just deleting the line entirely, but for now let's just try commenting out the hanging line "variable=" .
Cool, the game works without error now! Let's move on to something more complicated.
Runtime Errors
This error message is a bit scarier, but let's have a look at one.
Well, there're a few different pieces of information in here. Let's start with the first three lines.
That's some useful stuff, right there. On the first line, it says what kind of error it is, which helps you understand what to look for. Runtime errors differ from syntax errors in that they happen while the game is in operation as opposed to when the game compiles, and consequently can be a bit harder to track. Nevertheless, the third line tells us that the game tried to divide by zero, and if you've ever spent time in a math classroom you'll know that this is not something that you should generally try to do. Onwards.
This points out exactly where in the code it happened: Section 170 (the 170th entry in the Scripts editor), line 517. For the sake of convenience, this is the same spot in the code where the Syntax Error happened. Anyway, let's have another look.
Oops, that's not good. Now, ZeroDivisionErrors and similar probably aren't always going to be this easy to find - most of the time they're going to be the result of dividing a variable by another variable, meaning you're going to need to be able to trace the value through the code for a little while to see where the offending zero comes from. Fortunately, the rest of the error message is there to help. Again, from the top:
That's where the script was called from in the first place. A little farther down there's the contents of the offending script, to help you to know what to look for.
Here are a few different types of runtime errors that you might, ahem, run into.
NameError: if you've used other programming languages, this might take the form of "VariableNotFound/SymbolNotFound" or something similar. Essentially you're trying to access a variable that doesn't exist. Here's the offending code, try to find the issue (sorry to keep picking on pbChangePlayer, it's nothing personal, honestly).
NoMethodError: this is basically the same thing as a NameError, just for methods (the things called with parenthesis(and, argument, lists) ). Here's an example of one.
In this case - as I'm sure you can tell from the message by now - it's because I misspelled the method "pbChangePlayer." Happens if you're typing really fast, or maybe your fingers aren't lined up on the keyboard properly and you don't notice, or perhaps you've forgotten to add one of the scripts you need from EBS. It happens. Don't worry about it.
Other Errors
There's a whole host of other error messages you can get that I haven't mentioned here, these are just some of the easier ones to generate. If you don't see your particular issue here, you should probably consult the wiki, which has an entire page dedicated to some of the error messages that might pop up, or if that one works there's a fancy service called Google, where you can just punch in the error type and look it up on the world wide web yourself.
So when your game stops working and rudely spits a wall of text in your face, it's not the end of the world! Think of the wall of text as an Absol: if might be sort of scary when it jumps out at you but it's really just trying to be helpful. Read the message, track down the problem and be on your merry way!
Note: I'm used to using languages other than Ruby (namely Game Maker, Java and Python) so I don't go super in-depth about anything related to RPG Maker here, but this should be enough information to get you started when it comes to dealing with and eliminating those annoying error messages.
Syntax Errors
Let's have a look at what's probably the easiest error to debug, the Syntax Error.
All right, that tells us . . . something. Let's open up the script named PSystem_Utilities and scroll down to line 518.
Cool, that's . . . code. And lo and behold, if you look at the area around line 518, there's some funny business going on.
Urgh, that's probably not supposed to be there. You can do a few things there, like placing an expression on the right side of the equals sign or just deleting the line entirely, but for now let's just try commenting out the hanging line "variable=" .
Cool, the game works without error now! Let's move on to something more complicated.
Runtime Errors
This error message is a bit scarier, but let's have a look at one.
Well, there're a few different pieces of information in here. Let's start with the first three lines.
That's some useful stuff, right there. On the first line, it says what kind of error it is, which helps you understand what to look for. Runtime errors differ from syntax errors in that they happen while the game is in operation as opposed to when the game compiles, and consequently can be a bit harder to track. Nevertheless, the third line tells us that the game tried to divide by zero, and if you've ever spent time in a math classroom you'll know that this is not something that you should generally try to do. Onwards.
This points out exactly where in the code it happened: Section 170 (the 170th entry in the Scripts editor), line 517. For the sake of convenience, this is the same spot in the code where the Syntax Error happened. Anyway, let's have another look.
Oops, that's not good. Now, ZeroDivisionErrors and similar probably aren't always going to be this easy to find - most of the time they're going to be the result of dividing a variable by another variable, meaning you're going to need to be able to trace the value through the code for a little while to see where the offending zero comes from. Fortunately, the rest of the error message is there to help. Again, from the top:
That's where the script was called from in the first place. A little farther down there's the contents of the offending script, to help you to know what to look for.
Here are a few different types of runtime errors that you might, ahem, run into.
NameError: if you've used other programming languages, this might take the form of "VariableNotFound/SymbolNotFound" or something similar. Essentially you're trying to access a variable that doesn't exist. Here's the offending code, try to find the issue (sorry to keep picking on pbChangePlayer, it's nothing personal, honestly).
NoMethodError: this is basically the same thing as a NameError, just for methods (the things called with parenthesis(and, argument, lists) ). Here's an example of one.
In this case - as I'm sure you can tell from the message by now - it's because I misspelled the method "pbChangePlayer." Happens if you're typing really fast, or maybe your fingers aren't lined up on the keyboard properly and you don't notice, or perhaps you've forgotten to add one of the scripts you need from EBS. It happens. Don't worry about it.
Other Errors
There's a whole host of other error messages you can get that I haven't mentioned here, these are just some of the easier ones to generate. If you don't see your particular issue here, you should probably consult the wiki, which has an entire page dedicated to some of the error messages that might pop up, or if that one works there's a fancy service called Google, where you can just punch in the error type and look it up on the world wide web yourself.
So when your game stops working and rudely spits a wall of text in your face, it's not the end of the world! Think of the wall of text as an Absol: if might be sort of scary when it jumps out at you but it's really just trying to be helpful. Read the message, track down the problem and be on your merry way!
- Credits
- everyone else who told me to do this, and probably Aki