RGSS scripting dissections and explinations
#78
Siletrea Wrote:hmm the "super" statements... its like small bakesale!
the original list of items for sale would be muffins and cupcakes and brownies! BUT somewhere down the line a new seller in the bakesale comes in with cookies and tarts! instead of going to the computer and building up a whole new list from scratch and then having to print everything out and replace the old sign they just take a pen and add the new items on at the bottom of the list!
right? Happy with a sweat

$save_point.members << @Siletrea << @Kyonides
Girls.add(@siletrea, @another_girl)

Those lines would be quite similar to what you described above, even if they handle people or cats.

Continuing with your bakery example...


Code:
class Business
  def initialize
    @open_store = true
  end

  def prepare_products
    @list_of_available_products = [ ]
  end
end

Code:
class FlourDistribuitor < Business
  def prepare_products
    super
    @list_of_available_products << "Flour"
  end

  def deliver_product
    @received_phone_call = true
    @loaded_truck = true
    @drive_off_to_bakery = true
    @leave_flour_there = true
  end
end

Code:
class Bakery < Business
  def prepare_products
    super
    @list_of_available_products << "Last Bread" << "Last Muffin"
    @new_list_of_ingredients = ["Flour", "Sugar"]
    @clean_tools = true
  end

  def call_flour_distributor
    @call_flour_distributor = true
    @send_them_list_of_ingredients = true
  end
end

Code:
@flour_distributor = FlourDistributor.new
@puma_bakery = Bakery.new
@puma_bakery.prepare_products #=> Siletrea finds out she needs more flour!
@puma_bakery.call_flour_distributor #=>  She calls the flour distributor then
@flour_distributor.prepare_products
@flour_distributor.deliver_product

As you can see both the flour distributor and Puma's Bakery are businesses so they both need to do one thing in common, to prepare their products for distribution or sale at the store. There we called super to let both of them create a new list of products available at the time. It's like a distributor and a bakery sharing the same purchase / stock software like some basic system based on Excel? to make lists. Indifferent Take into account that both have their own procedures meaning they don't need to do the same steps another business did. So super allowed us to complete a series of required steps to keep both businesses running smoothly. Shocked
"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 - 11-15-2018, 04:51 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,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)