RGSS scripting dissections and explinations
#16
I already explained += with my age example on the first page so take a look at that post to find the answer.

>= greater than or equal to

if age >= 21
Siletrea.drinks_beer
else
Siletrea.gets_arrested_for_being_a_minor
end

modulo... well, it's a leftover, really, that's all the mystery behind it.

7 % 4 = 3

Why 3? Well, 3 doesn't fit in 4 so we still got 3 guys that couldn't enter in a cabinet to make a phone call to Shanghai while the other 4 are calling people in Minnesota, Hawaii, Guatemala and Turkey.

You may wonder why most classes define a specific method namely initialize

class AOne
def initialize
@teacher = 'Siletrea'
@students = []
@scores = {}
end
end

Well, it tells Ruby, not RGSS, that you need to make a new copy of Class A so every year you can accept new pupils in your AOne class (meaning A-1). You were hired to teach them how to bake stuff in an oven.

In 2016 you did this
@my_class = AOne.new

This year you repeated the same process.
@my_class = AOne.new

Why it isn't called new?

It's complicated, it's Ruby's fault. new does exist, or else you wouldn't get a new class at all, the catch is that its contents are protected except for a method namely initialize. Instead of making you create the whole AOne class object, Ruby does it for you (you or me or VVulf would get headaches if we had to do it manually by coding that on our own.) Since Ruby's intention is to make it easy for us to make new classes, guess what? It simplified it by making stuff for us and it's free as in beer and freedom of speech. This way we will only change or add stuff that we really care about like your students or their scores.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }


Messages In This Thread
RE: RGSS scripting dissections and explinations - by kyonides - 09-07-2017, 06:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Help iwth script (RGSS Player crash) Whisper 3 8,529 06-17-2017, 05:03 PM
Last Post: Whisper
  How can I use the cmd of "require" in rgss superegp 2 5,915 11-03-2015, 06:16 AM
Last Post: kyonides
   Scripting in VX vs VX Ace Miharu 5 9,090 02-21-2015, 10:10 AM
Last Post: Taylor
   Combat animations via scripting; How? ZeroSum 2 5,112 09-20-2013, 06:58 PM
Last Post: ZeroSum
Question  RGSS stoped to work Chaos17 5 7,747 02-14-2013, 05:13 PM
Last Post: DerVVulfman
   Ruby, RGSS & General Code Discussion Kain Nobel 6 10,884 12-22-2012, 05:11 AM
Last Post: MechanicalPen
   [Request] Tut. for RGSS Eldur 9 11,907 12-07-2012, 04:27 AM
Last Post: DerVVulfman
   [ASK-RGSS] Behemoth's CBS alike Getsuga_kawaii 0 4,227 04-29-2010, 03:07 PM
Last Post: Getsuga_kawaii
   Scripting I think spazfire 7 10,170 04-12-2010, 03:21 AM
Last Post: DerVVulfman
   Beginner Scripting Tuts? KDawg08 1 4,136 03-31-2010, 11:03 PM
Last Post: Hsia_Nu



Users browsing this thread: 12 Guest(s)