Common Errors (and How to Fix Them)

Oct 20th, 2019 (edited)
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.52 KB | None | 0 0
  1. Common Errors (and How to Fix Them)
  2. Syntax Errors:
  3. Common points to check, the line the error points at, as well as the line just before it, as either can cause the error.
  5. Error Line points to an end:
  6. There are two possible causes for this type of error depending on the location of the end. The first is the end is the very last one in the script section or proc, the second is when it is not.
  7. In the first case, this means there are not enough ends, and you might have missed placing one higher up. For the future, you should always type both halves of the def/end, if/end, case/end, class/end, loop do/end, for/end, module/end, and any other that I have not mentioned.
  8. In the second case, this means you have too many ends. Sometimes this happens when you copy and paste code from another spot and take the ifs and ends with it.
  9. The fixes for both are the same, go down through the script from the top, adding a level of indentation for every if, def, class, module, case, and all of the other situations that require an end. you also have to remove a level of indentation for every end. If you end up with an indentation level that is not 0, but you've finished the method/class/module, then you are missing a few ends. A negative level, too many. This method does allow you to establish the location of missing ends for loops and if blocks, provided of course, you know what the code is supposed to be doing.
  12. Runtime Errors:
  13. An awful lot of errors in general can be fixed by deleting the save file or renaming the project (which dissociates it from the default "Pokemon Essentials" Save file you probably have).
  15. "Filename is nil":
  16. This error shows up because a helper method could not find a corresponding image (like the pokemon battler or icon), so it gives an invalid result.
  17. Generally, based on where you crashed, you'll know which file it choked on, or at least an idea (what ever pokemon it tried to load).
  18. - Load screen is almost always because you have a party from a different project and it contains pokemon which don't exist in this project (else you'd have icons for it). Rename your project already!
  20. "undefined method 'name' for nil:NilClass" (last call stack trace "PField_Field:408"):
  21. When you get this error, that means the game tried to load up a map that was deleted from the game. Chances are you deleted the map on purpose, so just deleting the save will do the trick to fixing this error. Fun fact, on the default load screen, if the map name is blank, you deleted it through RMXP, so the MapInfos.rxdata no longer has the name, while if you just deleted the map in the Data folder directly, the old map name will still appear, because the MapInfos was never updated.
  23. "undefined method 'pokedexSeen' for nil:NilClass":
  24. This one shows up because the $Trainer wasn't set up. That should normally be done in your intro event, so compare with the default ones.
  26. pbChangePlayer(0)
  27. pbTrainerName
  29. Are the critical method calls.
  30. "undefined method '[]' for nil:NilClass" (last call stack trace "PScreen_PokedexMain:328:in 'pbGetDexList'"):
  31. If you end up giving two pokemon the same regional dex number in the PBS, this error will occur. There's no easy way to check for this, but at least you know the cause.
  32. You can also get this error if you skip some regional numbers for a particular regional dex.
  34. "undefined local variable or method 'foo' for #<CLASS_NAME:0xdeafbeef>":
  35. This error shows up because you've tried to call a method or use a variable that doesn't exist in class 'CLASS_NAME'. This may be because you've mistyped the method/variable or because you failed to define it. Good on you for learning to script though!
  37. "undefined method '>' for nil:NilClass" (last call stack trace "PokeBattle_Battler:2736:in 'pbProcessMoveAgainstTarget'"):
  38. This error shows up because you've forgotten a return in your def pbEffect for the function code of the last used move. Most of the default move effects have the line "ret=super(attacker,opponent,hitnum,alltargets,showanimation)" and "return ret" at the end.
  40. "PSystem_Utilities:855:in `[]'cannot convert false into Integer" (Catching a pokemon with a "getForm" property, usually):
  41. This error is actually a bug in v17.2. The fix is here, in Maruno's reply:
  43. "Symbol as array index"
  44. This one shows up because you ended up doing something like this: [1,2,3,4][:REPEL]. If you got this error while trying to do a getName, that's because you need to convert the symbol to a number. So PBItems.getName(getID(PBItems,:REPEL)) is the trick. If that wasn't what you were doing, you'll still need that getID probably.
  45. "Script 'Scene_Intro' line 78: NameError occurred. uninitialized constant IntroEventScene::PBSpecies"
  46. So, PBSpecies is the module with all of the pokemon constants in it. It is created when the game is compiled, so if you stop the compilation in the middle, that module might not be created, and when you run the game normally, through Game.exe, instead of looking for module PBSpecies, it defaults to a constant PBSpecies. Run your game from the green playtest arrow, and hold down CTRL while the game boots up. This will force a recompile, and correct the issue.
  48. RMXP Errors:
  49. Hopefully you don't get any of these...
  51. "This version is from an old version of RPG Maker XP":
  52. Or something like that. This error is generally because the Game.rxproj is saying it's using an older version number (usually 1.02) while the latest is 1.05. Just copy the Game.rxproj from a working project in, that'll do the trick.
  54. "Failed to load Actor data":
  55. This one really sucks to get. It tends to point to a corrupted project. Have no fear because a number of the .rxdatas are not actually used by Essentials, like Actors, Armors, Classes, Enemies, Items, Weapons, Troops, States, and Skills. If replacing all of those doesn't do the trick, you can still potentially salvage the project, by copying over the MapInfos and Map files, as well as the PBS files, graphics, and audio. Try to copy over Tilesets and Scripts too, so you don't lose too much.
  56. This is damage control mode though, so take this as a lesson in making back ups if you haven't already.
  58. Popular Script Errors:
  59. This isn't an extensive list, but some scripts are pretty popular.
  61. General Fixes:
  62. v17 renamed some classes when compared to v16.2. This breaks scripts when they try to alias methods in those classes because the old name doesn't exist anymore.
  63. This is a link to assorted renamed classes:
  65. Pokemon Followers:
  66. "undefined method '>' for nil:NilClass":
  67. That one shows up because it tried to load an animation from a non-existant index. Make sure you close RMXP completely before you replace the Aimations.rxdata.
  68. "Game_CommonEvent:27:in 'trigger'undefined method 'trigger' for nil:NilClass":
  69. This one appears because the Common Event index you set for the script is out of bounds, way too big.
  71. Luka's Scripts (EBS, etc.):
  72. "undefined method 'isVersion17?' for nil:NilClass":
  73. This error happens because you've missed Luka's Utilities script. That one should be installed in a script section above all of the other scripts Luka SJ has made.
Add Comment
Please, Sign In to add comment