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.

Could RMXP access Internet?

Well, if you look through Ruby's info, you should find how. I can't find my reference book at the moment, and I will try to post again if I find it.

EDIT: What kind of file? HTML?
 
if the file is in FTP then you can(from what I know, you can't directly download files from the web, unless you use WinApi class probably, or access some outer program from ruby)

But to setup the FTP class is a pain in the ass.
 

Gust

Member

Twar3Draconis;161321 said:
Well, if you look through Ruby's info, you should find how. I can't find my reference book at the moment, and I will try to post again if I find it.

EDIT: What kind of file? HTML?

Ruby has a module to do that, but rgss don't.
And I don't know how to, or if it's possible to use that module with RMXP.
I even tried to copy the library directory from ruby into my game and use "require" but it says "No such file to load" ¬¬

Mr. Mo, where could i find a class/tutorial to access ftp?
I would prefer http, but if there's no way...
Well, thanks anyway, if anyone find it, tell me please!
Cya

PS: Sorry for any language mistakes, i'm from Brazil. Bye!
 
Fala irmão Gustavo! Também sou do Brasil cara! ^^ Mas como só tem gringo aki eu vo ter que explicar em inglês msm... xD

You should use $: variable to add require paths into your game. That way, you should try getting the path to your Game executable (the main folder in this case) and include as much subpaths as you want. This was what i tried:
Code:
module GamePath
  temp =  File.expand_path("Game.exe")
  @main = File.dirname(temp) + "/"
  @audio = @main + "Audio/"
  @data = @main + "Data/"
  @graphics = @main + "Graphics/"

  class << self
    attr_reader :main, :audio ,:data, :graphics
  end
  
end

$: << GamePath.main
$: << GamePath.audio
$: << GamePath.data
$: << GamePath.graphics
$: << GamePath.main + "Scripts/"
$: << GamePath.main + "Scripts/lib"
So, every time the game looks for require files without a complete path, it goes into all those paths you added
Description of the $: array:
Programming Ruby":1c546tk5 said:
via the -I command-line option, followed by an installation-defined standard library location, followed by the current directory (``.''). This variable may be set from within a program to alter the default search path; typically, programs use $: << dir to append dir to the path. {}
Well, the $: thing didn´t worked as i expected, but i could require my .rb files with the GamePath paths., like
Code:
require GamePath.main + 'script.rb'
Just take care, you can´t read/save/require txt files inside Graphics and Data folders if your game is (or will be) encrypted.
 

Gust

Member

Aí cara! Vc participa de algum site brasileiro de RM?

Erm, thanks for that, but it's not exactly what i was searching XP
I will try require the ruby scripts this way, but could be possible there isn't a easier way, or one that don't use so much space?
I think I would need a dll that make that for me or something like that...

Ok, not a particulary enlightening post but..
What file are you trying to read and how are yu doing so?

I want to read a .ini file. I got a method to do that with a file in the game's folder.
Now, I want this ini file stay in a website, so that the player would select "Update Game Data", the Game would access the web and copy the file to the game's folder.
 
ok, i have little knowlage in Ruby, but isn't there a way to "Trick" the game into looking for a file on the internet. so instead of finding file "/Rmxp.ini" you'd look for file "/..www.x.com/RMXp.ini" or something?
the /.. is there to make it go two folders up in the heirachy... I think..
 
fuzzy_memories;163905":3ei71ce2 said:
ok, i have little knowlage in Ruby, but isn't there a way to "Trick" the game into looking for a file on the internet. so instead of finding file "/Rmxp.ini" you'd look for file "/..www.x.com/RMXp.ini" or something?
the /.. is there to make it go two folders up in the heirachy... I think..

I think you mean ..\ but that wouldn't work. you see, accessing local files on your computer is one thing, but to communicate with another computer over a network requires a completely different protocol. Hyper Text Transfer Protocol (HTTP) is what the web browser uses to view webpages. File Transfer Protocol (FTP) is best for transfering files, but again, you'd have to be able to have the ability to incorporate that protocol into rmxp. I'm not familiar with programming and scripting, but I do have training in networking, and I think I can safely say there is no way you can easily "trick" rmxp (or any program) in that manner.

PS: let's say your game folder was in My Documents. "..\www.x.com\RMXp.ini" would look in C:\Documents and Settings\Your_User_Name\My Documents\www.x.com\RMXp.ini" and since that file and folder does not exist on your computer, that would only return an error.
 

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