RGSS scripting dissections and explinations
#90
Well, naming a scene after a person is not a good idea since it won't describe what the scene will do if you call it... What about you making a scene like this?

First we create a few objects that represent real life stuff.

Code:
class LivingBeing
  attr_accessor :name, :age
end

Code:
class Person < LivingBeing
  attr_reader :pets # only gets @pets value (an Array or basket for all of the pets)
  def initialize
    @name = ""
    @age = 0
    @pets = [] # The basket you bought for your kittens!
  end
end

Code:
class Pet < LivingBeing
  attr_accessor :attitude # gets and sets @attitude 's value (a string, a text, a label)
  def initialize
    @name = ""
    @age = 0
    @attitude = ""
  end
end

Here comes the scene itself!

Code:
class Scene_PetConvention # Everything takes place in a Pet Convention!
  def main # Everything that happens once the convention has started
    siletrea = Person.new # you're a person, aren't you? O_o?
    siletrea.name = "Siletrea" # you've got a name of your own
    siletrea.age = 22 # Guessing here...
    @puma = Pet.new # setting up a specific pet object representing... Puma!
    @puma.name = "Puma"
    @puma.age = 10 # Guessing here...
    @puma.attitude = "aggressive" # yeah, the poor cat girl is a claw-happy kitten
    siletrea.pets << @puma # you placed all of your pets in a basket or anything like that
    dervvulfman = Person.new
    dervvulfman.name = "DerVVulfman"
    dervvulfman.age = 60
    @patches = Pet.new
    @patches.name = "Patches"
    @patches.age = 12
    @patches.attitude = "spoiled" # yeah, he spoils all of his cats :P
    dervvulfman.pets << @patches
    @owners = [siletrea, dervvulfman] # Now both of you are partaking in the contest!
    Graphics.transition # The announcer lets the owners and their pets come in
    loop do # The contest is being broadcasted!
      Graphics.update # Like a video, it needs to scan the surroundings every so often, like every second
      Input.update # Whatever people say or a poll to collect people's votes
      update # Define what you want the audience or the organizers or the judges or the pets do during the contest
      break if $scene != self # If show is over, let the announcer tell who was the winner pet
    end # End of the broadcast
    Graphics.freeze # Last picture taken with any cam or cellphone
    @owners.clear # dispose of anything related to the owners
  end

  def update
    # The contest takes place here in this case... Any changes should go here
  end
end

Keep in mind # or pound symbol or hash symbol or whatever you wanna call it, turns anything behind it into a comment in Ruby, and Ruby ignores comments!

Edit: I also had to correct my previous reply because I misread a couple of little mistakes you made like mixing the roles > ms pacman and < pacman have in scripts. (So > is no longer reverse pacman? Laughing You made it sound like the evil Inverse Flash back then. )
"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 - 12-28-2018, 05:51 AM

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



Users browsing this thread: 2 Guest(s)