iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Closed TopicStart new topic
> [-Scripting-] Script Troubleshooting for the Non-Scripter, Some simple tips to follow when a script isn't working correctly
modern algebra
post Sep 18 2010, 10:42 PM
Post #1



Group Icon


Type: Coder
Alignment: Unaligned




Script Troubleshooting Tutorial for the Non-Scripter


Apologia

Most errors that people see from released scripts are not major and can easily be fixed, even by the non-scripter. The purpose of this tutorial is to teach some very basic strategies on diagnosing and fixing common errors without any particularized scripting knowledge. It does not aim to teach you how to script, but simply goes through a few of the most common errors you are likely to encounter when using custom scripts and what can be done about them by yourself, before asking the scripter. In the main part of this tutorial, I will go through some common error messages, what they might mean, and how to fix them. I will not be explaining why these errors occur or why these tips fix them since that requires some knowledge of scripting, and this tutorial is aimed at the non-scripter. If you would like to know, feel free to ask me in this topic and I will explain to the best of my knowledge.

Caution

Most of the tips in this tutorial do not require you to do any substantial editing to your script, since if that is required, your best strategy is to go to a scripter. However, if you do try to edit a script, do not do so in your main project. It is a lot safer to make a test project and do any editing there, as even small errors on your part may become quite a headache and it's better to be safe. Again, there is nothing in this tutorial that would require you to do any major editing, this caution is mostly just in case you get creative. Don't get creative.

General

Remember: the first thing to do when encountering any error is to go to the topic where the author published the script and see if anyone else has had the same problem and if the error has been addressed. The easiest fix is the one you don't have to do. Secondly, if this tutorial does help you to fix the error, then you should still alert the author of the script to the error. It is a simple courtesy and one which you should always undertake, as scripters want their scripts to be bug-free.

Also, some common errors, such as the bug where you can't set a variable to the stats of an actor, are bugs in the default scripts and not the result of any custom script. A good set of fixes for these can be found in Yanfly's Core Fixes and Upgrades. Check those out and see if the bug you are getting is resolved by one of those scripts.

Common Errors

  • Unable to find file
    QUOTE
    Unable to find file Graphics/Directory/Filename.

    Spoiler:
    As you might already appreciate, this is probably not a problem with the script. It doesn't even have to be related to the script. Maybe you deleted a character face that you use in a message. However, when this error is related to a script, it probably means that you forgot to download necessary files, or placed them in the wrong folder, or named them incorrectly. Go to the website where you found the script and make sure you have all the necessary files. If it still isn't working, re-read the instructions to make sure you've done everything that you're supposed to have done. If so, go into the script and look for a configurable section. It may have a part where you set which graphic to use in a particular situation; make sure it refers to an existing graphic and isn't misspelled or anything. If none of that works, then it may be the very rare scenario where the scripter made a mistake in his/her code or failed to include necessary instructions. Alert the scripter to the error.

  • SystemStackError
    QUOTE
    Script 'Slot Name' line x:SystemStackError occured.

    stack level too deep.

    Spoiler:
    This is a recursion error. If it happens without having reset, then you probably can't do anything about it by yourself as it is either a serious logic error or an incompatibility. Alert the scripter and ask them to fix it. If, however, it has happened anytime after you pressed F12 to reset the game, then the problem could be that the script aliases a hidden or inherited method, in which case it is easy to fix. Go into the script editor to the slot and line identified. Look to the name of the method that line is within (i.e. the closest "def whatever_name" line). Somewhere in that class, there should be a line which aliases that method and it will look like:
    ~ alias whatever_alias whatever_name
    Some scripters will put that line right above the method they are redefining. Others will put it at the top of the class. Find it and change it to:
    ~ alias whatever_alias whatever_name unless self.method_defined? (:whatever_alias)
    You may need to repeat the process for a number of methods. This is a good place to follow the directives of the caution. Also, just in case you don't realize this, "whatever_alias" and "whatever_name" could be anything - I use those labels simply for ease of reference. For instance, it could be:
    ~ alias mit_lsu_name_1er4 name
    in which case to fix it, you would replace it with:
    ~ alias mit_lsu_name_1er4 name unless self.method_defined? (:mit_lsu_name_1er4)

  • RGSSError
    QUOTE
    Script 'Slot Name' line x:RGSSError occured.

    failed to create bitmap.

    Spoiler:
    When the slot name is 'Cache' and the line is 80, then as Mithran notes:
    QUOTE (Mithran @ Jun 29 2009, 08:47 AM) *
    ... This problem is most likely caused by either an invalid or blank image file trying to be loaded, or another file with the same name as the image file trying to be loaded in the same directory that is not an image file your Title folder should hold only valid images and only one of each by any given name (Bitmap class will load the first file with the name, regardless of the extension)...

    In other words, find out which graphic was trying to be loaded and then go to the corresponding folder in Graphics (like System, Battlers, Characters, etc...). Make sure there is only one file in the folder by that name and make sure it is a valid image file.

    As GubiD notes, this error may also occur when a script tries to create a Bitmap with a width or height of less than 1. This is most likely a logic error on the part of the scripter and he or she will need to be alerted. However, if there is a configuration section that allows you to choose the width or height of something (like a window) then it could be a user error as well. Make sure that any time there are values like that, they are within appropriate parameters. (This may or may not be a problem depending on the script - I know for some of my scripts where I let the width or height of something be configurable, I will have a value of -1 be an indication to have the window's size be automatically sized depending on other factors, such as the size of other windows at the time or the resolution of the screen. So read the instructions, but that may be the problem.)

    Similarly, this error can occur if the width and height are too large, and that may occur where a script generates the size of a Bitmap depending on how many items are to be listed in the window. That can happen if you have, for instance, lots of different stacks of items in Scene_Item. Mithran wrote a fix for this problem - Window Selectable Max. Yanfly also wrote a fix for that in her Core Fixes and Upgrades, though it is not as good as Mithran's since it cuts off offending items in the list. The other thing you could do is simply reduce the number of items that will appear in the list at any given time.

  • NoMethodError
    QUOTE
    Script 'Slot Name' line x: NoMethodError occured.

    undefined method 'method_name' for object

    Spoiler:
    There are a number of possible reasons for this error, some of which would require a scripter to take a look. However, there are a couple situations where this can easily be fixed by you.
    • You're loading an old save file.
      A lot of scripts are designed to setup data upon initialization. For a lot of saved objects, such as actors, that initialization happens only once by default, when you first start the game. Generally, if this is the case, then the object identified in the error message will be nil. Just start a new game and this error will go away if this is the problem. If it is absolutely crucial that you preserve this save file, then contact a scripter and if he/she is willing, then it is a simple matter to manually initialize the necessary data for that save file.
    • The scripter misspelled a method name or changed a method's name without changing a line that refers to it.
      As silly as it sounds, this is not super uncommon, especially where it is not a critical element of the script and therefore wasn't tested properly. This is likely not the case if the object identified is nil. So look at the class that object belongs to. Object will look something like: #<Class_Name:0x2eeb330>. Ignore the latter stuff and just look at Class_Name. Find out which class that is, and then look for the method 'method_name' is intended to refer to. Keep in mind that it may be any number of other issues, so only act on this if it is obvious this is what happened. If you do find something similar and believe that misspelling is likely to be the issue, then return to the line that threw the error and replace the misspelled method name with the method name you found.
    • Script Incompatibility
      The most common reason for this error is incompatibility. See the section on them for details on how to resolve a problem like this.


  • Syntax Error
    QUOTE
    Script 'Slot Name' line x. SyntaxError occurred.

    Spoiler:
    This error message will appear at the very start of the game before the title screen even loads up. If it occurs in-game and doesn't give a script name or line, then it is very likely a call script error and I encourage you to take a look at that. Anyway, it is very rare for one of these errors to be in a published script, since they are the easiest to find and fix, and any attempt to test it will identify the error. By and large, when this error occurs, it is one of three things: (1) the script was corrupted by BBCode when it was posted; (2) you copied the script incorrectly (left out a line or two, for instance); or (3) you made an error when configuring the script. So first, go to the place where you got the script and try recopying the script. If it has a demo, test the demo and see if it works there. Then, look for errors in your configuration if it has a configuration script. Things that you should particularly look out for are unclosed brackets and quotation marks. Another thing to look out for are hashes. When setting up a hash (which will typically be setup as:
    ~ CONSTANT = {
    ~ a => x,
    ~ b => y,
    ~ etc...
    ~ }
    where a, b, x, y can be anything) it is easy to make a mistake. Things to look out for are that the middle part is => and not just =, and that there is a comma after each line (though not necessarily the last). Anyone of those will cause a syntax error. Usually, if it's a configuration error, the line it identifies should be near the line that causes the error, which is not always the case with syntax errors involving unclosed branches. If you have ruled out any error on your part in copying or in configuration, then alert the author of the script and ask for his/her help.

  • Call Script Errors
    Spoiler:
    Some scripts have options that allow you to use the Script event command to modify or track something about the script; maybe set a variable to a value or something. You follow the directions perfectly, but then you still get an error message popup. These error messages can take many forms, but the most common are Syntax and argument errors. Check the way you setup the call script and make sure the expression is all on one line, as these errors often occur when you have the expression take more than one line in the script call. This is very easy to fix; all you need to do is set some of the objects to short local variables. Look for periods. As a general rule, you can split a code at any point before a period. For instance, if you are asked to do something like:
    $game_variables[y] = $game_party.quests.quest (z).objectives.size
    That's mostly nonsense, but it illustrates my point. You can store any number of those objects in separate variables. For instance:
    a = $game_party.quests
    $game_variables[y] = a.quest (z).objectives.size

    or:
    a = $game_party.quests.quest (z)
    $game_variables[y] = a.objectives.size

    or:
    a = $game_party.quests.quest (z).objectives
    $game_variables[y] = a.size

    Anyway, I'm sure you get the idea by now; all of the above will work. Splitting at a period is, I think, the easiest way for a non-scripter to split an expression safely so that it will fit on one line (keep in mind it doesn't work for numbers, so you couldn't split 100.0 by setting a to 100 and use a.0). You shouldn't put the whole of the first part of the equation (before the equal sign) into a local variable though as then you wouldn't be getting your desired result.

    There are other ways to fit an equation on one line as well. For instance, the expression above would also have worked just to split it at the = sign.
    $game_variables[y] =
    $game_party.quests.quest (z).objectives.size

    However, not every expression you'll want to split is of that form, whereas every expression that you want to evaluate will have parts that you can split up, so you should use that way unless you know better.

    Also, don't use leading zeros when you are inputting numbers in a call script, even if the game normally represents those as having leading zeros. In other words, if you are setting variable 25 to something, then it is:

    $game_variables[25]

    not:

    $game_variables[0025]


Script Incompatibilities

The most common reason for a script not to work properly is a conflict with another script. If none of the above tips resolve your error, then you should look into the possibility that it is a script incompatibility. The first thing to do is confirm whether it is a script incompatibility. To do this, make a new project and recreate the error-throwing situation. Then move the problem script into that project. If the error does not occur, then it is a script incompatibility. If it is, then you have to identify which other script is causing the problem. Move each of your other scripts into the clean project one by one until the error occurs. The last script you added is the conflicting script. Now that you know which scripts are problematic, try switching their order in the Script Editor. In other words, if Script X is above Script Y, move Script Y above Script X. Try running the project again and see if the error occurs. If it does then there's not much more you can do by yourself. However, your work in identifying the errors is not all for naught. Alert the authors of both scripts to the incompatibility and ask them for help. The fact that you have already identified the incompatible script and have a clean project with only the error situation in it means that they will probably be much more motivated to help you as half their job is done.


Closing Note

There are probably a bunch of other common and simple little errors I didn't think of when writing this tutorial. If you can think of any, then just bring them to my attention and if there is likely to be a simple fix then I will add it to this tutorial. Also, remember that even if your bug is fixed by following the tips in this tutorial, you should always report errors to the author of the script as a courtesy. Moreover, if your bug is not fixed by the tips in the tutorial, you should always ask the author of the script first and, if he/she refuses, then post a topic asking for help from other scripters.

This post has been edited by modern algebra: Jul 12 2011, 12:33 PM


--------------------
ATS 3.0
Quest Journal 2.1a
My Other Scripts
Spoiler:
Alphabetical: A-M; N-Z
Go to the top of the page
 
+Quote Post
   
IceDragon
post Sep 19 2010, 01:42 AM
Post #2


I demand cookies.
Group Icon


Type: Coder
Alignment: Neutral Good




Well done MA.
This is a very IMPORTANT Tut, or maybe a guide.

I hope others will read this!


--------------------
Spoiler:





To be Hexa-fied


Spoiler:
Other/Reminders--
Support your cookie loving dragon!

CODE
[url="http://www.rpgmakervx.net/index.php?showuser=52960"][img]http://i56.tinypic.com/2d1pfmw.png[/img][/url]


http://www.rpgmakervx.net/index.php?showto...amp;#entry48215 HA AUTOTILES
Pine's Birthday is the 2th of July

WORK ON YOUR TIME MEMORY @___@
Go to the top of the page
 
+Quote Post
   
modern algebra
post Sep 19 2010, 01:57 AM
Post #3



Group Icon


Type: Coder
Alignment: Unaligned




I'm glad you like it. Hopefully some non-scripters will find the tips helpful as well smile.gif


--------------------
ATS 3.0
Quest Journal 2.1a
My Other Scripts
Spoiler:
Alphabetical: A-M; N-Z
Go to the top of the page
 
+Quote Post
   
shadwblitz
post Sep 19 2010, 10:29 AM
Post #4


Discotheque ♥ Love
Group Icon


Type: Writer
Alignment: True Neutral




Thanks for this. I keep on getting the NoMethodError, only to find out that it's from old save files. =_=

Thanks m.a.


--------------------
Spoiler:



Go to the top of the page
 
+Quote Post
   
Super Stick Lyon...
post Sep 19 2010, 10:31 AM
Post #5


Preußischer Generalfeldmarschall
Group Icon


Type: Artist
Alignment: Neutral Good




QUOTE (modern algebra @ Sep 18 2010, 09:57 PM) *
I'm glad you like it. Hopefully some non-scripters will find the tips helpful as well smile.gif



I'm absolutely positive that they will wink.gif

Much thanks, Modern Algebra


--------------------
My Projects:

Supported Projects:
Spoiler:






But the age of chivalry is gone. That of sophisters, economists, and calculators, has succeeded; and the glory of Europe is extinguished for ever. Never, never more shall we behold that generous loyalty to rank and sex, that proud submission, that dignified obedience, that subordination of the heart, which kept alive, even in servitude itself, the spirit of an exalted freedom. The unbought grace of life, the cheap defense of nations, the nurse of manly sentiment and heroic enterprise, is gone!

--Edmund Burke
Go to the top of the page
 
+Quote Post
   
modern algebra
post Sep 19 2010, 02:38 PM
Post #6



Group Icon


Type: Coder
Alignment: Unaligned




Thanks for the nice comments. I added a couple more common errors and simple fixes.


--------------------
ATS 3.0
Quest Journal 2.1a
My Other Scripts
Spoiler:
Alphabetical: A-M; N-Z
Go to the top of the page
 
+Quote Post
   
BlackHunter59
post Jul 2 2011, 11:44 PM
Post #7



Group Icon


Type: Undisclosed




Nice work but i have a problem how can i fix :
Script 'Scene_Title' line 81:TypeError
Go to the top of the page
 
+Quote Post
   
BigEd781
post Jul 3 2011, 01:11 AM
Post #8


No method: 'stupid_title' found for 'nil:NilClass`
Group Icon


Type: Coder
Alignment: Chaotic Good




Moved to RGSS2 support, link retained in the tutorials forum, and stickied. This is useful stuff, thanks MA.


--------------------
My blog - It's awesome, I assure you
QUOTE
While sloppy writing does not invariably mean sloppy thinking, we've generally found the correlation to be strong -- and we have no use for sloppy thinkers. If you can't yet write competently, learn to. - Eric Raymond

---
My awards for being so awesome
Spoiler:
Go to the top of the page
 
+Quote Post
   
Mr. Bubble
post Jul 3 2011, 07:16 AM
Post #9



Group Icon


Type: Undisclosed
Alignment: Unaligned




Here's another error that comes up on occasion: http://www.rpgmakervx.net/index.php?s=&...st&p=154650

Script 'Cache' line 80: RGSSError occurred.
Failed to create bitmap

QUOTE (Mithran @ Jul 29 2009, 08:47 AM) *
... This problem is most likely caused by either an invalid or blank image file trying to be loaded, or another file with the same name as the image file trying to be loaded in the same directory that is not an image file your Title folder should hold only valid images and only one of each by any given name (Bitmap class will load the first file with the name, regardless of the extension)...


--------------------
I no longer support Tankentai.
Go to the top of the page
 
+Quote Post
   
Ease30
post Jul 6 2011, 01:19 AM
Post #10



Group Icon


Type: Artist
Alignment: Neutral Good




Yay!, thanks for the tutorial this will actually help me a lot. thumbs bro.


--------------------
I Support:

Go to the top of the page
 
+Quote Post
   
GubiD
post Jul 6 2011, 03:00 PM
Post #11



Group Icon


Type: Coder




Mr Bubble, I would like to add to that comment by Mithran on that. This also happens anytime you try to generate a bitmap (Bitmap.new) using a width or height of 0 or lesser. I have seen this in a couple scripts when things go wrong.
Go to the top of the page
 
+Quote Post
   
modern algebra
post Jul 8 2011, 04:07 PM
Post #12



Group Icon


Type: Coder
Alignment: Unaligned




Thanks for the sticky smile.gif I forgot all about this tutorial.

Thanks Mr. Bubble (and Mithran); I will add that error to the list. Thanks also GubiD for the clarification, though if the error occurs when trying to generate a bitmap with a width or height of 0 or less, then it is likely a logic error where the scripter didn't anticipate that the variable he/she passed to the Bitmap could go less than 0, and in that case a non-scripter would probably not be able to fix it by him or herself. Though, I suppose it could also be a configuration error on the part of the user and it would be useful to mention it at least.


--------------------
ATS 3.0
Quest Journal 2.1a
My Other Scripts
Spoiler:
Alphabetical: A-M; N-Z
Go to the top of the page
 
+Quote Post
   
Mr. Bubble
post Jul 11 2011, 01:37 AM
Post #13



Group Icon


Type: Undisclosed
Alignment: Unaligned




QUOTE
Similarly, this error can occur if the width and height are too large, and that may occur where a script generates the size of a Bitmap depending on how many items are to be listed in the window. That can happen if you have, for instance, lots of different stacks of items in Scene_Item. Yanfly wrote a fix for that in her Core Fixes and Upgrades, though it is not a perfect fix as it will cut off the offending items in the list. As far as I know, there is no perfect general fix for it, but a scripter might be able to whip something up for you by, for instance, swapping bitmaps. The other thing you could do is reduce the number of items that will appear in the list at any given time.


I'm not sure if this perfectly fixes this issue, but Mithran made a fix for this quite some time ago.

Window Selectable Max 2.0


--------------------
I no longer support Tankentai.
Go to the top of the page
 
+Quote Post
   
modern algebra
post Jul 11 2011, 11:36 AM
Post #14



Group Icon


Type: Coder
Alignment: Unaligned




Cool - I had never seen that before. I added it to the first post there.


--------------------
ATS 3.0
Quest Journal 2.1a
My Other Scripts
Spoiler:
Alphabetical: A-M; N-Z
Go to the top of the page
 
+Quote Post
   
Leonlionheart
post Jul 19 2011, 02:19 AM
Post #15



Group Icon


Type: Designer
Alignment: Unaligned




I got to say, this is probably one of the most helpful tuts I've read ohmy.gif

Helped me pinpoint some issues. :3 just wanted to say thank you.

This post has been edited by Leonlionheart: Jul 19 2011, 02:20 AM


--------------------
Go to the top of the page
 
+Quote Post
   
modern algebra
post Jul 22 2011, 10:47 AM
Post #16



Group Icon


Type: Coder
Alignment: Unaligned




I'm glad that you found it useful smile.gif


--------------------
ATS 3.0
Quest Journal 2.1a
My Other Scripts
Spoiler:
Alphabetical: A-M; N-Z
Go to the top of the page
 
+Quote Post
   
Meta Knightmare
post Jun 2 2013, 06:31 AM
Post #17


Mercenary, Fanboy Exterminator, Fangame Designer...
Group Icon


Type: Designer
Alignment: Chaotic Good




What about uninitalized constants? Those pop up quite frequently for me.

EDIT: Oops, I'm necroposting. Sorry.

This post has been edited by Meta Knightmare: Jun 2 2013, 06:32 AM


--------------------
By the way, I am known everywhere else as Raymond Knightmare. Can't change my name here, sadly.

[blank space where my game sig bar should be]
Any ideas are welcome. Constructive criticism is also welcome, however, please don't push it. :)
Please play games before reviewing. It gives you a much more reliable indicator of how good the game actually is. Unless you are commenting on the page itself, which is an entirely different thing.

Flamers (and people who go too far with their "help") will want to read this.
Spoiler:
QUOTE
No posting with intent to offend.

This includes but is not limited to posting or posting links to:
- Insults
- Flaming
- Defamation


I am either going to be very blunt, or I will mince my words so bad you will interpret my words as the exact opposite of what they actually mean.

If you really need music looped or rudimentary scripting fixes done, don't hesitate to ask me.
Go to the top of the page
 
+Quote Post
   
???nOBodY???
post Jun 2 2013, 06:44 AM
Post #18


moogles + nightmares + coffee = Scripting Psychopathic Tendency
Group Icon


Type: Coder
Alignment: Chaotic Neutral




An uninitialized constant error occurs if you've failed to initialize a constant you're trying to refer to.

CODE
module NO
  EXAMPLE_CONSTANT = 5
end

def method
  e = 1 + EXAMPLE_CONSTANT
end


This would error, because it needs to be:

CODE
module NO
  EXAMPLE_CONSTANT = 5
end

def method
  e = 1 + NO::EXAMPLE_CONSTANT
end


--------------------
*The Master List Update Project is currently up-to-date with the latest scripts for that dream project!
*By entering the RGSS2/Ruby Scripting section, you are agreeing to abide by The Coder's Creed.

My Scripts
Spoiler:

ACK Script Requests
Spoiler:

Scripts
Stat Change Formulas
GTBS Ziifee's spin menu Submenus
GTBS Weapon Unleash
GTBS Enemy Status
Attack Command Submenu
Jump To (X,Y)
BGM/BGS Fadein
Window_Message - Pop Text
Spell Management Menu
Melee Mastery Management Menu
Ghost List
Save / Autoload
Some Popup v2.9 => v2.91
Scene_StringEntry v1.02
Scene_StringEntry: More Than 24-Character Input
Scene_StringEntry: Scrolling Character Input Window
Scene_StringEntry: Typing Input
MA's Quest Journal - Accept Quest Add-On (internal)
MA's Quest Journal - Accept Quest Add-On (external)
Easy-to-Add Extra Ziifee Spin Commands
Scrolling Battle Message
Non-Differentiating Enemies
Quest Item Drops
(VX) FP Conditional Drops
FFTA World Map HUD bugfix
RSSBS / SSS - Wereforms patch
Death Counterattack
Targetting Extension

My Heart (Resources)
Spoiler:

Projects
Project AMBROSIA
*something generically clever*

Support these:
Spoiler:







Awards:
Spoiler:

Go to the top of the page
 
+Quote Post
   

Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 30th July 2014 - 06:10 AM

RPGMakerVX.net is an Privacy Policy, Legal.