Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Detecting files in the RTP itself

That... is the question...

While the file_exists function/statement allows you to check on files in your game's project folder or in a folder/pathway specified in your filename, I haven't seen or heard of a RGSS method for checking the existance of files in the RTP itself.

Anyone got any clues on doing so? I really would like to know... for error checking routines.
 
Wouldn't it work giving the full path to check? Like this:

Code:
if file.exists?("C:\Program Files\Common Files\Enterbrain\RGSS\Standart\Graphics\Autotiles\001-G_Water01")
  # commands
end

I don't see why it wouldn't, though it's possible I made some errors writing the path ^_^
 
you don't have to write all that

if File.exists?("Graphics\Autotiles\001-G_Water01.png")
# commands
end

just that is fine. That works for me anyways.

btw, it won't work in encrypted projects ;)

Edit:
I've re-read your question.. BlueScope is right in that case.
 
Atually, he is not :( You can Install the RTP on different places, so that won't work. Actaully, there IS a global variable wich tells you the place of the RTP (If I recal correctly, something similar to %SYSTEMROOT%)...

But whatever, I would use: (example a picture):

Code:
begin
Bitmap/Sprite.bitmap = Rpg::Cache.picture('filename')
#exists
recue Errno::ENOENT #Captures File does not exists exceptions
#does not exists
end
 
@Me: I suppose, it'd be 'rescue', not 'recue' ^_^ Well, let's say I'm sure ^_^

But %SYSTEMROOT% should be the string that replaces C:\WINDOWS\system32\ , nothing more... maybe Enterbrain included a specific string for their RTP, but it's surely not this...
 
Heh.

Meâ„¢'s technique may be just what I need. Can't use the directory/pathway technique cause it can change dependant on where the RTP is set up. Thanks for the head's up on the encrytion Mr.Mo. Didn't check.

Will return when I get off of work (on Sunday) ... blah....

EDIT at 9:45PM (my time):

I took a look in the help file, and while testing with RPG::Cache will work for pictures and such, it won't work with music files (which unfortunately is what I need it for). And using the File.exists? works just the same way as FileTest.exist?(, only testing what is in the project and not in the RTP.

RMXP Helpfile":1yle25qx said:
The RTP installer creates a string value containing the RTP name in the "HKEY_LOCAL_MACHINE\SOFTWARE\Enterbrain\RGSS\RTP" registry key and uses it to set the path. RGSS recognizes the string specified in this key as the RTP.
Perhaps, someone knows how to access the registry???? ...Yeah... right... ':|
 
Doing some tinkering with the AudioFile class in module RPG, I came up with this... http://www.dubealex.com/asylum/style_em ... ex/cpu.gif[/IMG]



Code:
   begin
     @trd = RPG::AudioFile.new("026-Town04")
     Audio.bgm_play("Audio/BGM/" + @trd.name,1,100)
     print "Woohoo!"
   rescue Errno::ENOENT
     print "Waahhh!  Not there!"
   end
That's @trd as in I'm tired... http://www.dubealex.com/asylum/style_em ... /sleep.gif[/IMG] ... it's almost 1:00 am my time.

This little #$%^ plays a millisecond of the track I'm testing right now, but it IS testing 'BOTH' what's in the RTP and in the project folder. No file extensions necessary! http://www.dubealex.com/asylum/style_em ... /yahoo.gif[/IMG]


Thanks guys. This should come in handy with some audio-system add-ons.

EDIT:
Mimi's Battle Music now encorporates this system to prevent errors from crashing the game when a music file is called and doesn't exist. Again. Thanks for the help!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top