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.

.txt files in RGSS, but how?

Ares

Member

Hey everyone!

In poccil's pokémon starter kit I used some time ago, You could manage stuff in .txt files.
I needed to do that too, so I looked through the scripts in the project. But I couldn't find anything.

So my question is: How can I retrieve data from .txt files in RGSS?
 
If you need to retrieve information out of a text file, then doing

File.open(NAME, 'r') do |file|
file.each_line {|line| array << line.chomp}
file.close
end

Will put each line in the text file into the array in order as strings.
What specifically are you trying to do/use with txt files?

*NAME = file_name.txt in quotes
 

Ares

Member

Well, the text file may need updating every once in a while,
but I just need to retrieve each line as a string, which that code does.
I couldn't think of line.chomp, so I thought File.open wouldn't work.

Thanks!
 

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