How can I use the cmd of "require" in rgss
#3
You could try using load instead of require. Here is a small script to test it.

File contents
Code:
class NewsUpdate
    attr_reader :recent_events
  def initialize
      @recent_events = ['Eh...']
      print 'These are the news!'
    end

    def print_news
        print @recent_events.join("\n")
    end
end

Script call to load the file

load Dir.pwd + '/print text.rbw'

Simple example of how to create a new copy of the class included in the file only

$news = NewsUpdate.new

Simple example of how to call one of its methods by meas of a script call

$news.print_news

The downside of load methods is that it will actually load the file contents every time they are called. At least that's what happens on normal situations.
"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: How can I use the cmd of "require" in rgss - by kyonides - 11-03-2015, 06:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   RGSS scripting dissections and explinations Siletrea 97 104,441 03-18-2019, 06:46 AM
Last Post: Siletrea
   Help iwth script (RGSS Player crash) Whisper 3 8,533 06-17-2017, 05:03 PM
Last Post: Whisper
Question  RGSS stoped to work Chaos17 5 7,749 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,924 12-07-2012, 04:27 AM
Last Post: DerVVulfman
   [ASK-RGSS] Behemoth's CBS alike Getsuga_kawaii 0 4,231 04-29-2010, 03:07 PM
Last Post: Getsuga_kawaii
   Quick RGSS question - switches Ravenith 2 5,630 08-23-2009, 11:23 AM
Last Post: Ravenith
   How can i activate switches with rgss computerwizoo7 2 7,426 07-04-2009, 03:01 AM
Last Post: computerwizoo7
   Strange behavior RGSS Charlie Fleed 10 16,833 03-15-2009, 04:11 PM
Last Post: woratana
   How to check if actor has certain stat(s) with RGSS? Twin Matrix 4 9,767 01-04-2009, 05:35 PM
Last Post: Twin Matrix



Users browsing this thread: 1 Guest(s)