Slip into Ruby: An introductory guide to RGSS for beginners.

Thank you very much, at this point I got vertigo all the time (literally, not because of the topic) so it is impossible to study.

I will get well soon and see what you say to me, at the moment I cant focus and i barely can write right,

Hope I will recover in a few days.
Thanks for the reply.  I've fixed that, and fixed 2 other errors in what I had typed, but it's still not working as per the article.  Here is what I have now.

class Scene_Bestiary < Scene_MenuBase def start super @list_window = Window_EnemyList.new(0, 0, 200) endendclass Window_EnemyList < Window_Selectable def initialize(x, y, width) super(x, y, width, Graphics.height - y) data = [] self.index = 0 activate refresh endenddef refresh make_item_list create_contents draw_all_itemsenddef make_item_list @data = $data_enemies.compactenddef item_max @data ? @data.size : 1enddef draw_item(index) item = @data[index] if item rect = item_rect_for_text(index) draw_text(rect, item.name) endendWhen I interact with the NPC, I get the window, but it is blank, no enemies show up.  I have stared at that last bit of coding (draw_item) but cannot see what is wrong with it.

Thanks for the explanation about array.  You are probably right that you have explained it somewhere in the series, just not in these beginning articles, so it's being used without (for me) any content.

I have another question.  One of my other errors was that in line #28, I had used these brackets () instead of these [].  How do I know which to use, or is it a question of memorizing them?

Thanks
Generally you'll use () for parameters in methods and prioritising a particular calculation before other calculations in the same line, whereas [] deals almost exclusively with arrays or groups of objects.

At the point I think you're at right now, you shouldn't be seeing pictures or anything, but you SHOULD be seeing the names of the enemies in the list. Are you at least getting that? The images were in a later part.
No, I'm not seeing the list of names, just a blank window.
Ah, I see what it is. You've got an "end" that ends Window_EnemyList before you define the "refresh" method. Take out the "end" just before "def refresh" and put it at the end of the code.
Thank you.  All is now well, and when I have the time I can now go on to the next bit of that article.
OooooOh boy!  Take it relax Dread and regenerate.  Hope some friend and family gats turns around you to walk you to the fridge or stuff!
Thank you for this tutorial, it will help me learn RGSS a lot faster! In this regard I would like to ask you a couple questions.

I still haven't understood how does attr_accessor (and reader/writer) work, is that some sort of global variable?

In your first tutorial you wrote this:

Spoiler
class Animalattr_accessor :age def initialize @age = 0 end def breathe #code for breathing endend 
Can it be used only in the same class? Does ruby automatically know that :age refers to @age? (Is it valid only for instance variables?)

If I wanted to pass an instance variable from a class to another one (not a subclass), could I do it using attr_accessor? If so, how?

Sorry for all these questions, I'm still learning  :headshake:
An attr_accessor is basically telling Ruby you're okay with other classes and methods directly changing the value of the variable.

Symbols (Values starting with a colon) are kind of like variables but they have both a string and numeric representation and always point to the same object. The cool thing about them is that if you make an attr_accessor with a symbol as its name, the interpreter automatically creates an instance variable of the same name. In other words, in the sample code I made an attr_accessor called :age, so Ruby made me an @age variable free of charge.

Hope that helps explain it!
Oh I see, so it is universal, I can't create a symbol with the same name in another class, so I have to be careful when using it, I thought attr_accessor was a way to access an instance variable from an external class, in reality it only have to be used once for each variable/string, when declaring them.

Now it's all clear, thanks.
My last reply may actually have been a bit misleading, so I'll elaborate: attr_accessor isn't making the variable public or global or anything, it's actually just a shorthand way in Ruby to create getter and setter methods for you. Also you're right, as symbols are unique you can't use a different symbol with the same name anywhere else.
I'm quietly working my way through chapter one, part 3, and I've noticed something which leaves me slightly confused.  Twice in Chapter one, part 2 and once (so far) in part 3 you have referred to "indexth element".  Is "indexth" a typo, or is it pointing to something specific?
Sorry, it's just my cutesy way of saying it looks up the index of the array corresponding to the variable "index". For example, in an array my_array with values [106, 20, 25, 43, 97] and an index variable equal to 2, the indexth element would be my_array[2], which would be 25.
I think I shall file this explanation under the "something I'll understand later on" heading.  Thanks, at least I now know it's pointing to something specific, not a typo.
I'll see if I can explain it in a "something you'll understand now" way. 🙂

Okay, you know what a variable is, right? It's basically a changeable value with a specific name. For example, if you wanted to track a hero's HP, you'd make a variable called "hp" and set that to the hero's actual HP value, so that rather than having to look up the value every time you needed it you could just refer to your "hp" variable instead.

An array is like a variable that holds a set of other variables. For example, let's say we want to track the HP for every hero in the party. Rather than declaring four variables called hp1, hp2, hp3 and hp4, we can store it as an array instead: [hp1, hp2, hp3, hp4]. However, rather than needing separate names for the variables, we just have one: "hp", and each individual value (element) is stored in an index, starting with 0. To get a value out of the array, we give it the index we want. So hp[0] will give us the first value, hp[1] the second, hp[2] the third, and hp[3] the fourth.

Does that make a bit more sense?
A lot more, thanks.
So, got the chapters thus far printed out and bound in a little book for later reading (prefering to read from a page over a screen when it's extensive amounts of text like that).

Man, I love working in a complete digital printroom some times. BD
You'll definitely be glad of that when you get to the ones dealing with battler classes. Jesus christ that was a lot of text.
You'll definitely be glad of that when you get to the ones dealing with battler classes. Jesus christ that was a lot of text.
I like big scripts and I cannot lie,

you other brothers can't deny... 😉
I worked through the first 4 parts, and I had to say, it was quite fun to see it come together. I don't understand everything I did, but I am understanding far better than I did before I started the tutorials. I had a question though, in the second tutorial (or maybe the third, I can't recall off hand), you started using the term rect. I looked it up in the help menu (because I didn't want to ask without doing my research), and it says it means the rectangle class, but that hasn't really cleared up what it actually is for me. So my question is, what does rect actually mean?

Original thread: https://forums.rpgmakerweb.com/threads/slip-into-ruby-an-introductory-guide-to-rgss-for-beginners.38900/