Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I use the cmd of "require" in rgss
#1
I want to make a game in Internet.I have already done it by win32API. Now I think whether I use the cmd of "require" to import Ruby's lib??
tip: I'm a Chinese and weak in English....... Sad
Reply }
#2
我從來沒有嘗試過使用它,直到如今。我不認為它喜歡我。甚至當我用的是整個文件路徑,我收到一個錯誤。它說,該文件不存在,甚至與整個路徑。

我只是複製使用它的腳本到腳本庫,而不是。一個.RB文件只是Ruby代碼的文本文件反正。至少,這就是每次我反正看到。

這與谷歌翻譯。我的中國是很好的餐廳,沒有別的訂購。



I never tried to use it until now. I do not think it likes me. Even when I use the entire file path, I receive an error. It says the file does not exist, even with the whole path.

I would just copy the script into the script library instead of using it. A .rb file is just a text file of ruby code anyway. At least, that's what every I've seen anyway.

------------ Anyone else??? ---------------
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 }
#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 }


Possibly Related Threads…
Thread Author Replies Views Last Post
   RGSS scripting dissections and explinations Siletrea 97 89,487 03-18-2019, 06:46 AM
Last Post: Siletrea
   Help iwth script (RGSS Player crash) Whisper 3 6,492 06-17-2017, 05:03 PM
Last Post: Whisper
Question  RGSS stoped to work Chaos17 5 6,849 02-14-2013, 05:13 PM
Last Post: DerVVulfman
   Ruby, RGSS & General Code Discussion Kain Nobel 6 9,813 12-22-2012, 05:11 AM
Last Post: MechanicalPen
   [Request] Tut. for RGSS Eldur 9 10,488 12-07-2012, 04:27 AM
Last Post: DerVVulfman
   [ASK-RGSS] Behemoth's CBS alike Getsuga_kawaii 0 3,828 04-29-2010, 03:07 PM
Last Post: Getsuga_kawaii
   Quick RGSS question - switches Ravenith 2 5,089 08-23-2009, 11:23 AM
Last Post: Ravenith
   How can i activate switches with rgss computerwizoo7 2 6,866 07-04-2009, 03:01 AM
Last Post: computerwizoo7
   Strange behavior RGSS Charlie Fleed 10 14,859 03-15-2009, 04:11 PM
Last Post: woratana
   How to check if actor has certain stat(s) with RGSS? Twin Matrix 4 8,892 01-04-2009, 05:35 PM
Last Post: Twin Matrix



Users browsing this thread: