Guest Access
EVENTALIST
EVENTALIST
EVENTALIST
profile
A tool that is not required by this tutorial but was designed to be an assistant to help when programing can be found here. http://gameface101.playogame.com/t2025-a_noob_made_extractor#25217
mr_wiggles
profile
Noobing my way across Ruby in RPG Maker XP.
In just ten easy steps, you can learn to code your very own scripts in RPG Maker XP in no time!
Prolog:
- Spoiler:
The Title of this Tutorial system may offend people, however if your that easily offended by one's words of criticism, even though in this instance if you where offended by any way, then it was a self entitlement of the word when reading it. It's not that I'm calling the people who are looking to learn from this any kind of hurtful word because the word 'my' or myself is in the title.
This is simply a summary of a compilation of the methods I have learned over the course of several years. When I first started, I knew nothing at all about game making. Shear will to learn and be able to play D&D but be that dungeon keeper. That creator of the gauntlet that we wish to put our NPCs through. People, in my opinion love movies, they love relating to characters and seeing 'life' but with little interaction. Some people yell at that screen and try to change the plot because they 'relate' to the characters and an attachment, similar to a friendship is made.
What I'm getting at is that as an art form creating games that allow players to interact and change the story and play it their way is what drives us into them. Where simply not getting lost in the plot of a series (youtube, cable, satalite) where like "creating" a series as we play the game (open-world concepts). Its writing an interactive novel, its composing that masterpiece of music that is enhanced by the environment you created.
Game creation is like building an online club house, its interactive its got "members only" permissions and secret-ocity to it that draws you in. The best games always get you with, why are all these people talking about getting the high score in #{insert_name} or that character that everyone falls in love with, eh?
So it only seems like the best thing to do would to be to build that club, design that dope music, draw those mouth watering pictures. The tutorial I'm going to be talking about below and posting lessons too; will not help you with any of that. Creation is an art in itself and you will have to invent and create your own ideas in time.
This Tutorial is to teach you about the 'glue' that adhesive that allows you to to put all of those creative ideas together, and present them to the player. I'm a self-proclaimed noob, and im fine with it. :p
Step 1!
- Spoiler:
To begin, like most of every tutorial I've encountered, we'll start with the shell command print(). Being 'shell' it is accessible at all times regardless of location in script. If it doesn't work for you, it was simply not called.
This being said it is the base of any script debugging and should be acknowledged as such. The print function is a lot like a bottle neck, where you can vent out information in the script. During this time though, the RPG Maker will pause in the background. This is handy because it doesn't allow, in most of my cases, variable values to change during the time a print window is showing in RMXP. However, this can be an annoyance at times depending on the way you call it. You might not want to use 'loop do; print("leedle-leedle-leedle"); end' because you WILL be spammed with so many messages it will be hard to filter threw them.
So we move onto the next topic we will need to understand. Block Statements; these are quite simply put a conditional block. You've surly heard the saying 'what if?' in life? This is kind of like that in a way. You compile a block, similar to building a house, or a car, or even a book. There are clear definitions in these items right? A book has a begging and an end clearly defined. A car has its wheels touching the ground the clocks that rotate and the engine that fires in such a rhythmic purr. And a house, strong, with a good foundation block hat has room blocks that are all under the main block, the roof. The roof is only as strong as the blocks beneath it, and the car will only purr if it'd been properly lube and maintained. That house will fall if each block is not structurally sound, a pipeline may leak, the air that is conditioned might fall stagnant.
So when coding in blocks, which is how Ruby was designed, you should use proper formatting. This will help you when you read the code for debugging. You are ALLOWED to use '#' comment flags for lines and take notes, anything after that tag will NOT be read by the compiler when the game runs. You are also allowed to use indentations and return spaces in your scripts. This is though, entirely up to your own style you adapt while learning. You don't have to follow my advice in using proper indentations, but it WILL make things easier on yourself.
Now, let us move onto using the print() tool shall we, finally? - lol
You more then likely already know "Hello World" but my problem was that no one seemed to inform you on really what you just did. No.. not like binary switching and such, or really how it works, (in depth like what its code looks like) but, how it is a tool, and you just issued your first step into understanding a new world. When you used print() you DIRECTLY interacted with yourself didn't you? You where able to make the computer show you something that you typed and scripted. Not impressive? Well it is the first concept we should grasp, that Ruby will look for 'objects' (and blocks {} ) that fall under that word you typed.
There are many base 'objects' that each have their own built in calls (words, like "Hello -") that are defined. They have many uses as well, just REMEMBER that everything in Ruby is a class. Classes are constants, meaning they can't be changed when the game is running. So what ever is defined in them when you write your script is compiled in as well.
To do this properly, Ruby has other tag words, or even symbols. Such as:
- Code:
{ module, class, def, loop, while, if, else, elsif, case, when, end }
Review of Statments made above:
So let us begin with actually wrting some code. Like stated above Ruby is Object based, so things for the most part need to be built into proper block statments. Bellow is some exsample code doing such.
- Code:
class My_First_Noob_Class # tag 0
#----------------------------------------------
def myfirst_function_definition
if 1 > 0 # tag 1
print("Yep, one is bigger then zero.")
end
#----------------------------------------------
if 0 < 1 # tag 2
print('Zero is still smaller.')
end
#----------------------------------------------
if 1 > 0 # tag 3
variable = 1 + 7
print("The value of variable is: #{variable}.")
elsif 0 < 1
myfirst_function_call()
else
print("Hello World")
end
end
#----------------------------------------------
def myfirst_function_call(*args)
args = *args
print("I've been called from a diffrent location with this attachment: #{args}.")
end
end
Lets just take a closer look at whats going on here. Yes we seem to really be using that print() function now, But what did we DO?
You notice how their are tabs that indent lines that help define blocks? The ones that create the main structer 'class' needs to have a footing 'end' for the roof of a house can't be floating with out a foundation starting point to define the end, literialy, of the structer. Tabing these and using a streamline format can allow you to find errors in your code faster. This is the main problem for most scripts that I write durting the first stages of building the concept. I will end up missing the placement of one of these block 'end' statments and it will crash with that oh so famillar syntax error.
The problem with a syntax error that is caused from a block left open can be troublesum to find, because the print error information given is usually not the line where it happened at. Proper indentations will help you see those faults quickly.
I was also chosing to make visiable comment only ' # ' lines that are breaks from the text. This is nice because it will let you see when functions start and end. This is also nice when function definitions ' def ' get very long and you think your in another function by the time you get scrolling down to the bottom of it in the editor.What did I even learn in this garbage?
That Ruby is object based, to call objects they need adresses in the form of tag words and names (words) that are typed by you, or ones that others have made; like the base classes in Ruby.
Step 2!
- Spoiler:
Coming soon!
A tool that is not required by this tutorial but was designed to be an assistant to help when programing can be found here. http://gameface101.playogame.com/t2025-a_noob_made_extractor#25217
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
EVENTALIST
profile
mr_wiggles
profile
Hey, I'm Finnally going to take a stab at creating a scripting tutorial. :3
wish me luck, lol.
wish me luck, lol.
EVENTALIST
Show Signature
EVENTALIST