Having trouble learning rgss

Hello! I'm not quite sure this is the right place to ask but I'd assume so. I'm having trouble learning ruby scripting. I've tried to look for sites or videos, but I can't find anything. Specifically, I can't find the definition to these " reserved words ". This is the list of words I found while searching which go under this name:

BEGIN class ensure nil self when
END def false not super while
alias defined? for or then yield
and do if redo true
begin else in rescue undef
break elsif module retry unless
case end next return until

I've found the definition of " class " and " def ", but nothing on the other words. If someone could explain to me what they do and an example of what they'd be used for or a link with the information I desire it would be greatly appreciated. I don't want to use other people's scripts as I'd rather be able to make them myself.

Also, bonus question. Does it matter what I put after " def "? I've seen people either use " initialize " or " main " and I don't know if that means anything or not. Thank you for reading! :LZSsmile:

(I have no programming experience, if that matters)
Hi !

The reserved words are keywords reserved to specific contexts in ruby. You do not need to know all of their purpose to code in ruby, just keep in mind that using them outside of their context will create errors in your code.

Since you have no knowledge of programming, I suggest you learn the basics with tutorials either in ruby or other simple languages like Python.
I've found this one online that seems decent: https://www.learnrubyonline.org/
You will learn here how to display values, deal with variables and basic operations. Then you will see conditionnal branches (if/else) and loops (for, while...). You will deal with basic objects (Array and Hash tables) and finally will deal with methods (or functions).

When you are done with the basics, you can then consider learning about classes and modules.

If you want to rush into rpg maker scripting, you can also directly take some scripts (if you use VX Ace, I suggest Yanfly's) and look into the code and try to understand what they do.

While it is commendable to want to learn how to script to be able to do your own things, I suggest that you still take scripts online if they do what you aim for, it will save you plenty of time, you will even learn more things as you look into their code!

And feel free to ask questions in the forums, there are many knowledgable scripters around here.

Edit:
You may also look at thèse tutorials made specifically for rgss and ruby (links in the posts):
Timtrack said:
You do not need to know all of their purpose to code in ruby, just keep in mind that using them outside of their context will create errors in your code.

On the contrary, it'd be great if the OP knows ALL of them, and understands how to use them properly.

sonicsuperadventure said:
Also, bonus question. Does it matter what I put after " def "? I've seen people either use " initialize " or " main " and I don't know if that means anything or not. Thank you for reading! :LZSsmile:

def comes from define, and it's a vital "command" for Ruby or else you'd end up with empty classes and modules that might or might not include CONSTANTS and @@class_variables.

Do you need a new method? Then go define it by selecting a name that will give you an idea on what it does.

You better learn what parent class / superclass & child class means before you use super.
If you know what alias means in Ruby, you pretty much know what super does in a class that has a parent class.

super - calls the parent class's method at some point
alias - calls the current class's original method at some point

This super class has to have defined the same method or super will fail.
alias can be used as many times as you want but it only works in the current class and its child classes. Other child classes of its parent class will ignore it.

Just a weird example: class A with the laugh! method has child classes B and C. B modifies the laugh! method's behavior by laughing nervously, but C does not so it still laughs normally.

true, false & nil are Ruby's boolean values. Well, nil isn't a true boolean value at all, yet, Ruby treats it as one for the sake of convenience. They're all used to test an object's truthy or falsey value, meaning that something IS real or IS NOT the case or IS NOT BECAUSE IT DOESN'T EXIST.

Timetrack said:
If you want to rush into rpg maker scripting, you can also directly take some scripts (if you use VX Ace, I suggest Yanfly's) and look into the code and try to understand what they do.

Terrible idea. Anybody should start with the default RGSS scripts instead. Never rush or you'd end up coming up with scripting monstrosities. Seriously.

sonicsuperadventure said:
I don't want to use other people's scripts as I'd rather be able to make them myself.

Are you patient? You don't care about making a huge effort to understand object oriented programming?

Then go ahead and get ready to burn your eyelashes because you'll have to read a lot of texts, code, etc.

You're not? Then quit now and avoid getting terrible headaches every so often. 😉

Original thread: https://forums.rpgmakerweb.com/threads/having-trouble-learning-rgss.176242/