Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 RGSS scripting dissections and explinations
#37
Staying away from integers is impossible! Even your bills have them! Even defining where a new window or sprite should be located on screen needs them! Labels displayed on screen like how much gold your heroes carry along need them! The catch would be that most of the time you'd only need to handle Integers (1, -2, 1000000 and such) and kind of rarely some floats like 1.2349 or Math::PI if you need to calculate angles and x and y coordinates with some help of Math.sin(x) and Math.cos(y) or angles and distances with Math.atan(dx,dy) and some details I skipped here on purpose because I know they're too complex for you XD

Don't tell me you didn't get the idea after reading my previous post about three times... -_-'

Expression Substitutions...

If you know what a substitution means then it won't take long for you to understand why they do exist.

@substituted_player = Player.new
@substituted_player.name = "Stan"
print "#{@substituted_player.name}, the kind of old hockey player, steps out right now and gets a seat in no time." # => "Stan, the kind of old hockey player, steps out right now and gets a seat in no time."

@substitute_player = Player.new
@substitute_player.name = "Ralph"
print "#{@substitute_player.name}, the hockey newbie, steps in." # => "Ralph, the hockey newbie, steps in."

I hope these two hockey related examples tells you something about what they actually do and how they work. Just in case I'll let you read what would have happened if we didn't "substituted" the @instance variable with its method name like I showed you above. (We're gonna make a mistake on purpose.)

print @substituted_player.name ", the kind of old hockey player, steps out right now and gets a seat in no time."
ArgumentError: wrong number of arguments (given 1, expected 0)
from (irb):3:in `name'
from (irb):3
from /usr/bin/irb:1:in `<main>'

Argument = Parameter = value you pass to Ruby via any specific method, here it's print.

On RMXP you've watched a pop up window furiously appear on sight to tell you something like the error message posted above and your game project would be shutdown immediately afterwards.
"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-09-2017, 10:14 PM

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



Users browsing this thread: