RGSS scripting dissections and explinations
#19
+= Now that's a shortcut. Instead of saying a = a + 1, you say a += 1. So each time we see a value of 'a', we add 1 to it.

-= Another shortcut. Just like above, this one subtracts from the value in question.

< is a 'comparison' operator. It means 'lesser than', and is used in checks like if a < b. If the value of a is 15 and the value of b is 4, then it would be like if 15 is less than 3... Obviously not! That test would FAIL.

And yeah, it is also used for the whole inheritance thing. Laughing Pacman here does double duty.

> is another 'comparison' operator. It means 'greater than', and is used in checks like if a > b. So again, if the value of a is 15 and the value of b is 4, then it would be like if 15 is greater than 3... NOW it works! So that IF... block of code will run!

<= and >= respectively mean 'less than or equal to' and 'greater than or equal to' Remember the test of if a < b? If a was set to 5 and b was set to 5, then it would be if 5 was less than 5.... and again, FAIL. But if we did if a <= b, it would work because it was not if a was less than OR EQUAL TO!!!

Equal signs!!! What is different between = and == ? Well, the first replaces the contents of a variable and one does a comparison test.

a = 4 .... this replaces the contents of variable 'a' with the value of '4'

if a == 4 .... this tests if the contents of variable 'a' equals '4'

Oh, the MODULO symbol!!! It means the 'remainder'

%... otherwise the percentage symbol, it is used in programming to get the REMAINDER value of a division. Like... um...
If you divide 9 by 3, your value is 3, right? There's no remainder. It's clean and has nothing fractional. But if you divide 9 by 2, you get 4 1/2 (or 4.5)

NOW unless you tell the program that you are dealing with numbers with decimal values (we call them floats), you're only going to end up with whole numbers. So an INTEGER version of 9 divided by 2 would actually equal 4! That's where modulo comes in... it gets the remainder (or leftover part). So the 9 % 2 would be '1' It can handle dividing 8 by 2, and has a leftover 1 remaining.

EDIT: Was I typing so long?????? Shocked

Oh, a child class is not weaker than the parent. It is inheriting all the goodies from the parent class. BUT, the child class 'IS' dependent upon its parent. Without the Parent class of 'Window_Base', you would not be able to run 'Window_Selectable' unless Window_Selectable had all those methods already in it.

BUT, you need to have it written class Child < Parent. You are first defining the class itself (class Child) and then attaching the contents of the parent to it ( < Parent).

It cannot go in reverse with class Parent > child. Nope nope nope.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }


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

Possibly Related Threads…
Thread Author Replies Views Last Post
   Help iwth script (RGSS Player crash) Whisper 3 8,530 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,113 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,885 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,228 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,137 03-31-2010, 11:03 PM
Last Post: Hsia_Nu



Users browsing this thread: 17 Guest(s)