Home > Tutorials > Ruby Game Scripting System 2 > The Guide to Scripting Volume 2
The Guide to Scripting Volume 2
The Guide of Scripting Volume 2
Errors and Functions
Made by Polar Tier.
Table of Contents:
Chapter 1: Solving Common Errors
Chapter 2: Modules
Chapter 3: The Conditional Branch
In this chapter you will learn how to prevent common errors and what caused them.
Error #1: Syntax Error
How to solve: Make sure you have the right amount of Ends in the script, if you have
1 too many or you need 1 more, make sure you remove/insert 1 in the right place. Otherwise
your script will end up having a wierd complex to it and can cause lots of errors. Also look for
any typos that can cause the game to crash... and also look at the order of processes.
Error #2: No Method Error
How to solve: This is caused from the script you are using trying to refer to a non-existent exception,
look for typos and look for the variable your script is referring to.
Error #3: Zero Division Error
How to solve: Look for the mathematical expression that caused the error and make sure it does not
multiply or divide by an impossible number... most commonly caused by dividing by zero, can also be
caused by using a mathematical expression that uses a letter or reference.
Error #4: EOF Reached
What causes it: It is caused by a file being opened then the game searching for non-existent data
inside the file and or looking for too much.
Error #5: Stack level too deep Error
How to solve: This is caused from a process(s) being too long or infinite... this can be caused from
an updating process or a def referring to itself and rerunning itself causing it to be infinite, try
reviewing your process(s) that caused the error, and try to simplify it(them)
These are the most common errors in RGSS2.
Modules are simple to make and in this tutorial we will create a sample. A module can do both store
a variable and preform an action, simply to create a variable inside the module just type the name of
the variable and what it equals, as the starting of the variable equaling NIL you cant add, subtract,
multiply, and divide it until its value is set... so it should look like this "myexample = 100", this will
make it a value, to make it a string just type "myexample = "String"", this makes it a string that can
be used for text. To make a function all you got to do it make a def, except this time your name will
look different, it will contain self (the module name) + .(definition name), it will look like this "def
self.myexample", then you just put your functions in there then end it.
The conditional branch can be both very complex and very simple... a conditional branch only runs
when the condition returns true, the conditional functions are if, and, or, and unless. Every conditional
branch must end with an end... if should look like a def, it looks like this "if EXAMPLESTRING ==
"Dumbstruck"" then a new line, then it carries the function then ends, for 1 or more things are
necessary to run a conditional branch you should put "if EXAMPLESTRING == "Dumbstruck" and
EXAMPLEVARIABLE == 2" then put your functions then end it, if it only needs 1 of the following
things to be true then you use an or instead of an and, here is an example of unless "unless Exm ==
2" then insert your functions then end it, that is all for this volume. Thank you for viewing.... This is
Exclusive to RRR, www.rpgrevolution.com.
The Guide to Scripting Volume 2
Sun, 12 Sep 2010 15:47:50 -0400