Help - Search - Members - Calendar
Full Version: Download & Upload files with Rgss
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
berka
Upload & Download Files with Rgss
Version: 2.1
By: Berka


Introduction
Now, your crazy project is able to download and upload files on ftp or http servers.

Features
  • No external files/libs, only Apis
  • Fast transfers
  • ProgressBars...
  • Ftp and http support


Screenshots


Demo
RMVX
RMXP

Script
The Net module:
CODE
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                   Download & Upload Files with RGSS
#  par berka                      v 2.1                  rgss 2
#                         [url="http://www.rpgmakervx-fr.com  "]http://www.rpgmakervx-fr.com  [/url]                                    
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# thanks to: [url="http://www.66rpg.com"]http://www.66rpg.com[/url] for documentation on wininet
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ! do not use ftp which contains privates data
# ! this scripts need ftp account information !
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Ftp :
#    ï¿½â€“� receive :
#          Net::Ftp.download("dir_on_ftp/file.zip","./Graphics")
#    ï¿½â€“� send :
#          Net::Ftp.upload("./Graphics/file.zip","§dir_on_ftp/file.zip")
#    ï¿½â€“� make directory :
#          Net::Ftp.mkdir("/dir_on_ftp")
# Http :
#    ï¿½â€“� receive :
#          Net::Http.download("url","./Graphics")
#    ï¿½â€“� total octets downloaded :
#          Net::HTTP.dloaded
#    ï¿½â€“� size of file :
#          Net::HTTP.size("test.zip")
#    ï¿½â€“� % dl progress :
#          Net::HTTP.progress("test.zip")
#    ï¿½â€“� transfer time:
#          Net::HTTP.temps("test.zip")
#    ï¿½â€“� list files :
#          Net::HTTP.transfers
#    ï¿½â€“� file loaded? :
#          Net::HTTP.loaded?("test.zip")
#    ï¿½â€“� octets transfered :
#          Net::HTTP.transfered
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
module Berka
  module NetError
    ErrConIn="Unable to connect to Internet"
    ErrConFtp="Unable to connect to Ftp"
    ErrConHttp="Unable to connect to the Server"
    ErrNoFFtpIn="The file to be download doesn't exist"
    ErrNoFFtpEx="The file to be upload doesn't exist"
    ErrTranHttp="Http Download is failed"
    ErrDownFtp="Ftp Download is failed"
    ErrUpFtp="Ftp Upload is failed"
    ErrNoFile="No file to be download"
    ErrMkdir="Unable to create a new directory"
  end
end
include Berka::NetError
module Net
  W='wininet'
  SPC=Win32API.new('kernel32','SetPriorityClass','pi','i').call(-1,128)
  IOA=Win32API.new(W,'InternetOpenA','plppl','l').call('',0,'','',0)
  IC=Win32API.new(W,'InternetConnectA','lplpplll','l')
  print(ErrConIn)if IOA==0
  module FTP
    FSCD=Win32API.new(W,'FtpSetCurrentDirectoryA','lp','l')
    FGF=Win32API.new(W,'FtpGetFileA','lppllll','l')
    FPF=Win32API.new(W,'FtpPutFile','lppll','l')
    FCD=Win32API.new(W,'FtpCreateDirectoryA','lp','l')
    module_function
    def init
      #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
      ftp="ftp.server.com"        #
      port=21                      #  Modify !
      identifiant="user"            #
      motdepasse="password"      #
      #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
      @fb=IC.call(IOA,ftp,port,identifiant,motdepasse,1,0,0)
      ftp,port,identifiant,motdepasse=[nil]*4 # clear ftp ids !
      (print(ErrConFtp))if @fb==0
    end
    def download(ext,int='./')
      init if @fb.nil?  
      c=ext.split('/').pop
      if FSCD.call(@fb,ext.gsub(c,''))!=0
        print(ErrDownFtp)if FGF.call(@fb,c,"#{int}/#{c}",0,32,2,0)==0
      else
        print(ErrNoFFtpIn)
      end
    end
    def mkdir(rep)
      init if @fb.nil?
      print(ErrMkdir)if FCD.call(@fb,rep)==0
    end
    def upload(int,ext)
      init if @fb.nil?
      if FSCD.call(@fb,ext)&&File.exist?(int)
        print(ErrUpFtp)if FPF.call(@fb,int,ext,2,0)==0
      else
        print(ErrNoFFtpEx)
      end
    end
  end
  #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  module HTTP
    IOU=Win32API.new(W,'InternetOpenUrl','lppllp','l')
    IRF=Win32API.new(W,'InternetReadFile','lpip','l')
    ICH=Win32API.new(W,'InternetCloseHandle','l','l')
    HQI=Win32API.new(W,'HttpQueryInfo','llppp','i')
    module_function
    def sizeloaded(i=0);@read[i];end
    def transfered;@dloaded;end
    def transfers;@dls;end
    def progress(i=0);(@read[i].to_f/@size[i]*100);end
    def loaded?(i=0);@read[i]>=@size[i];end
    def temps(i=0);@tps[i];end
    def size(i=0);@size[i];end
    def download(url,int='./')
      @dloaded||=0;@dls||={};@i||=-1;@size||={};@read||={};@tps={}
      a=url.split('/');serv,root,fich=a[2],a[3..a.size].join('/'),a[-1]
      print(ErrNoFile)if fich.nil?
      @dls[fich]=Thread.start(url,int){|url,int|txt='';t=Time.now
      ErrConHttp if(e=IC.call(IOA,serv,80,'','',3,1,0))==0  
      f=IOU.call(IOA,url,nil,0,0,0)
      HQI.call(f,5,k="\0"*1024,[k.size-1].pack('l'),nil)
      @read[fich],@size[fich]=0,k.delete!("\0").to_i
      loop do
        buf,n=' '*1024,0
        r=IRF.call(f,buf,1024,o=[n].pack('i!'))
        n=o.unpack('i!')[0]
        break if r&&n==0
        @read[fich]=(txt<<buf[0,n]).size
      end
      (File.open(int+fich,'wb')<<txt).close
      @dloaded+=@read[fich]
      ICH.call(f)
      @tps[fich]=Time.now-t
      sleep(0.001)}
    end
  end
end

Scene Example:
CODE
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                    Download & Upload Files with RGSS
#  par berka                      v 2.1                     rgss 2
#                          www.rpgmakervx-fr.com                                          
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#            EXAMPLES !
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Window_Barre<Window_Base
  Col1=Color.new(255,0,0)
  Col2=Color.new(0,255,0)
  def initialize
    super(100,50,344,316)
    @dls=Net::HTTP.transfers
    refresh
  end
  def refresh
    i=0
    self.contents.clear
    self.contents.font.size=22
    self.contents.draw_text(-16,0,self.width,WLH,"Http: Downloads",1)
    self.contents.font.size=20
    @dls.each_key{|file|
    self.contents.draw_text(0,56*(i+=1),200,WLH,"--> #{file}")
    self.contents.fill_rect(131,56*i+25,152,10,Color.new(0,0,0,150))
    self.contents.font.size=14
    rat="#{Net::HTTP.sizeloaded(file)/1024}/#{Net::HTTP.size(file)/1024} ko"
    self.contents.draw_text(132,56*i+32,150,WLH,rat,1)
    s=Net::HTTP.temps(file)
    self.contents.draw_text(20,56*i+20,self.width,WLH,"OK:#{s} secs")if Net::HTTP.loaded?(file)
    pr=Net::HTTP.progress(file)/100
    self.contents.draw_text(272,56*i,self.width,WLH,"#{(pr*100).to_i}%")rescue nil
    self.contents.gradient_fill_rect(132,56*i+26,pr*150,8,Col1,Col2)
    self.contents.font.size=20}
  end
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Download<Scene_Base
  def start
    super
    @fond=Spriteset_Map.new
    Net::HTTP.download('http://download59.mediafire.com/313lzxpdytpg/gyok0vgmm2m/hero+creator.zip')
    Net::HTTP.download('http://www.google.fr/intl/fr_fr/images/logo.gif')
    Net::HTTP.download('http://www.rpgrevolution.com/forums/banner3.gif')
    Net::HTTP.download('http://i42.servimg.com/u/f42/12/32/03/86/bannie11.jpg')
    @barre=Window_Barre.new
  end
  def terminate
    super
    @barre.dispose
    @fond.dispose
  end
  def update
    super
    @barre.refresh
  end
end

def telecharger
  Net::HTTP.download('http://download59.mediafire.com/313lzxpdytpg/gyok0vgmm2m/hero+creator.zip')
  Net::HTTP.download('http://www.google.fr/intl/fr_fr/images/logo.gif')
  Net::HTTP.download('http://www.rpgrevolution.com/forums/banner3.gif')
  Net::HTTP.download('http://i42.servimg.com/u/f42/12/32/03/86/bannie11.jpg')
end

The Net module
CODE
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                   Download & Upload Files with RGSS
#  par berka                      v 2.1                  rgss 1
#                         [url="http://www.rpgmakervx-fr.com&nbsp;&nbsp;"]http://www.rpgmakervx-fr.com&nbsp;&nbsp;[/url]                                    
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# thanks to: [url="http://www.66rpg.com"]http://www.66rpg.com[/url] for documentation on wininet
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ! do not use ftp which contains privates data
# ! this scripts need ftp account information !
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Ftp :
#    ï¿½â€“� receive :
#          Net::Ftp.download("dir_on_ftp/file.zip","./Graphics")
#    ï¿½â€“� send :
#          Net::Ftp.upload("./Graphics/file.zip","§dir_on_ftp/file.zip")
#    ï¿½â€“� make directory :
#          Net::Ftp.mkdir("/dir_on_ftp")
# Http :
#    ï¿½â€“� receive :
#          Net::Http.download("url","./Graphics")
#    ï¿½â€“� total octets downloaded :
#          Net::HTTP.dloaded
#    ï¿½â€“� size of file :
#          Net::HTTP.size("test.zip")
#    ï¿½â€“� % dl progress :
#          Net::HTTP.progress("test.zip")
#    ï¿½â€“� transfer time:
#          Net::HTTP.temps("test.zip")
#    ï¿½â€“� list files :
#          Net::HTTP.transfers
#    ï¿½â€“� file loaded? :
#          Net::HTTP.loaded?("test.zip")
#    ï¿½â€“� octets transfered :
#          Net::HTTP.transfered
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
module Berka
  module NetError
    ErrConIn="Unable to connect to Internet"
    ErrConFtp="Unable to connect to Ftp"
    ErrConHttp="Unable to connect to the Server"
    ErrNoFFtpIn="The file to be download doesn't exist"
    ErrNoFFtpEx="The file to be upload doesn't exist"
    ErrTranHttp="Http Download is failed"
    ErrDownFtp="Ftp Download is failed"
    ErrUpFtp="Ftp Upload is failed"
    ErrNoFile="No file to be download"
    ErrMkdir="Unable to create a new directory"
  end
end
module Net
  W='wininet'
  SPC=Win32API.new('kernel32','SetPriorityClass','pi','i').call(-1,128)
  IOA=Win32API.new(W,'InternetOpenA','plppl','l').call('',0,'','',0)
  IC=Win32API.new(W,'InternetConnectA','lplpplll','l')
  print(Berka::NetErrorErr::ConIn)if IOA==0
  module FTP
    FSCD=Win32API.new(W,'FtpSetCurrentDirectoryA','lp','l')
    FGF=Win32API.new(W,'FtpGetFileA','lppllll','l')
    FPF=Win32API.new(W,'FtpPutFile','lppll','l')
    FCD=Win32API.new(W,'FtpCreateDirectoryA','lp','l')
    module_function    
    def init
      #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
      ftp="ftp.server.com"          #
      port=21                      #  A modifier !
      identifiant="user"            #
      motdepasse="password"        #
      #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
      @fb=IC.call(IOA,ftp,port,identifiant,motdepasse,1,0,0)
      ftp,port,identifiant,motdepasse=[nil]*4 # efface les ids par s�curit�
      (print(Berka::NetError::ErrConFtp))if @fb==0
    end
    def download(ext,int='./')
      init if @fb.nil?    
      c=ext.split('/').pop
      if FSCD.call(@fb,ext.gsub(c,''))!=0
        print(Berka::NetErrorErr::ErrDownFtp)if FGF.call(@fb,c,"#{int}/#{c}",0,32,2,0)==0
      else
        print(Berka::NetErrorErr::ErrNoFFtpIn)
      end
    end
    def mkdir(rep)
      init if @fb.nil?
      print(Berka::NetErrorErr::ErrMkdir)if FCD.call(@fb,rep)==0
    end
    def upload(int,ext)
      init if @fb.nil?
      if FSCD.call(@fb,ext)&&File.exist?(int)
        print(Berka::NetErrorErr::ErrUpFtp)if FPF.call(@fb,int,ext,2,0)==0
      else
        print(Berka::NetErrorErr::ErrNoFFtpEx)
      end
    end
  end
  #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  module HTTP
    IOU=Win32API.new(W,'InternetOpenUrl','lppllp','l')
    IRF=Win32API.new(W,'InternetReadFile','lpip','l')
    ICH=Win32API.new(W,'InternetCloseHandle','l','l')
    HQI=Win32API.new(W,'HttpQueryInfo','llppp','i')
    module_function
    def sizeloaded(i='');@read[i];end
    def transfered;@dloaded;end
    def transfers;@dls;end
    def progress(i='');(@read[i].to_f/@size[i]*100);end
    def loaded?(i='');@read[i]>=@size[i]rescue nil;end
    def temps(i='');@tps[i]if loaded?(i);end
    def size(i='');@size[i];end
    def download(url,int='./')
      @dloaded||=0;@dls||={};@i||=-1;@size||={};@read||={};@tps={}
      a=url.split('/');serv,root,fich=a[2],a[3..a.size].join('/'),a[-1]
      print(Berka::NetErrorErr::ErrNoFile)if fich.nil?
      @dls[fich]=Thread.start(url,int){|url,int|txt='';t=Time.now
      Berka::NetErrorErr::ErrConHttp if(e=IC.call(IOA,serv,80,'','',3,1,0))==0  
      f=IOU.call(IOA,url,nil,0,0,0)
      HQI.call(f,5,k="\0"*1024,[k.size-1].pack('l'),nil)
      @read[fich],@size[fich]=0,k.delete!("\0").to_i
      loop do
        buf,n=' '*1024,0
        r=IRF.call(f,buf,1024,o=[n].pack('i!'))
        n=o.unpack('i!')[0]
        break if r&&n==0
        txt << buf[0,n]
        @read[fich]=txt.size
      end
      (File.open(int+fich,'wb')<<txt).close
      @dloaded+=@read[fich]
      ICH.call(f);sleep(0.01)
      @tps[fich]=Time.now-t}
    end
  end
end

The Scene Example:
CODE
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#                    T�l�chargement de fichiers en Rgss
#  par berka                      v 2.1                     rgss 1
#                          www.rpgmakervx-fr.com                                          
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#            EXEMPLES !
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Window_Barre<Window_Base
  def initialize
    super(100,50,440,380)
    self.contents=Bitmap.new(width-32,height-32)
    self.contents.font.name=$fontface
    self.contents.font.size=$fontsize
    # on initialise un tableau de t�l�chargement
    @dls=Net::HTTP.transfers
    refresh
  end
  def refresh
    i=0
    self.contents.clear
    self.contents.font.size=22
    self.contents.draw_text(-16,0,self.width,24,"Http: Gestionnaire de t�l�chargement",1)
    self.contents.font.size=20
    # pour chaque t�l�chargement
    @dls.each_key{|file|
    self.contents.draw_text(0,56*(i+=1),200,24,"--> #{file}")
    self.contents.fill_rect(131,56*i+25,202,10,Color.new(0,0,0,150))
    self.contents.font.size=14
    # on r�cupere le pourcentage du t�l�chargement
    pr=Net::HTTP.progress(file)/100
    # on �crit le rapport: octets t�l�charg�s / taille totale
    rat="#{Net::HTTP.sizeloaded(file)/1024}/#{Net::HTTP.size(file)/1024} ko"
    self.contents.draw_text(132,56*i+32,150,24,rat,1)
    # on r�cup�re le temps de t�l�chargement du fichier
    s=Net::HTTP.temps(file)
    # on l'�crit
    self.contents.draw_text(20,56*i+20,self.width,24,"Fait en #{s} secs")
    # on �crit le pourcentage de progression
    self.contents.draw_text(342,56*i+26,self.width,24,"#{(pr*100).to_i}%")rescue nil
    # et on trace la barre
    self.contents.fill_rect(132,56*i+26,pr*200,8,Color.new(0,255,0))
    self.contents.font.size=20}
  end
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class Scene_Download
  def main
    @fond=Spriteset_Map.new
    # chargement des fichiers
    Net::HTTP.download('http://download59.mediafire.com/313lzxpdytpg/gyok0vgmm2m/hero+creator.zip')
    Net::HTTP.download('http://www.google.fr/intl/fr_fr/images/logo.gif')
    Net::HTTP.download('http://www.rpgrevolution.com/forums/banner3.gif')
    Net::HTTP.download('http://i42.servimg.com/u/f42/12/32/03/86/bannie11.jpg')
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    @barre=Window_Barre.new
    Graphics.transition
    loop do
      Input.update
      Graphics.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @fond.dispose
    @barre.dispose
  end
  def update
    @barre.refresh
    $scene=Scene_Map.new if Input.trigger?(Input::B)
  end
end


Instructions
QUOTE
Ftp :
receive : Net::Ftp.download("file_on_ftp","./Graphics")
send : Net::Ftp.upload("file_in_project","dir_on_ftp")
Http :
receive : Net::Http.download("url","./Graphics")

The downloaded file has the same name of the original

FAQ
Paste this script above main

Compatibility
No Problem I think !

Credits and Thanks
Msdn, my best friend ^^
http://www.66rpg.com for parts of scripts !

Author's Notes
next feature:
evaluate the size of the file: done.
evaluate if the file exists: done.

Terms and Conditions
Free for using, but I need credits. Do not post this script anywhere without my permission !

enjoy,
berka
SuperMega
That's a fairly interesting idea. I might just have to try it out. Good job!
berka
thanks !
berka
onidsouza
Nice script berka! btw,
I am trying to connect my game in the internet, can you show me a tutorial, a demo, that tell's me how to use ruby and internet togeter? All my ruby books don't tell (i have a lot!), i can can't find anything usefull for me.
You still keep surprising everyone!
woratana
Sweet ^^/ This will be useful for the system with online function.
Midnight Assassin
Wow... great script! This is good for games that act like an XBOX 360, Wii or PS3 game. So with an internet connection, you can get more out of the game!

So, to upload a file from my Photobucket (HTTP Server) to the Graphics/System folder called 'Book', would I type in the following?
CODE
receive : Net::Http.download("http://i616.photobucket.com/albums/tt248/MidnightAssassin/Book.png","./Graphics/System")

Then I could use that image in my game, is that right?

Just one thing... could you upload a demo? This will make it easier to understand and use.
AmIMeYet
How did I not see WinINet when I tried this?! .. MSDN can be so complex wacko.gif

Great job!

Just a thought: Can you add support for POST-data?
"lpOptional [in] " should be the place to put that in, but I don't know what the exact format is.
I know, I know, you can always use get ( url?var=abc), but POST can be more secure (and fun!) I guess...

Also, how about 'temp' support? .. could be usefull..

And this script should be great for version-control.. happy.gif
berka
Thanks guys !

Sorry my example is quite bad:
the command is:

CODE
Net::HTTP.download("http://www.site.com/file.zip")


I've not tried to have interractions with *.php files

I gonna think about it !

berka
Midnight Assassin
So.. you cannot download files to certain folders? That blows... Great job anyway!

I found a problem. The downloading works fine, yet when I go to open the file from Explorer, it has a size of 0kb. I've tried PNG, ZIP, PHP, HTML, JS and many other formats - they all end up with an empty file in Explorer.
Eg: Downloaded Image.png => Went to explorer and found Image.png => Image.png has a size of 0kb.
berka
I'm programming a new version:
harder but better, faster, stronger ^^
(2.5Mo => 10 secs)
be patient !

berka
berka
New version released !
have fun !
berka
berka
XP version released !

berka
avatarfanatic280
I tried both versions of the demo- I had to change the configuration settings in the RMXP one, and they both crash. I really want to get this working, it looks AWESOME!

The XP one crashed right off the bat, but the VX one made it until I actually tried to talk to the guy that launches the download.

It might be Vista, because the security stuff in it will shoot down ANYTHING, but it doesn't give me the oh-so-innocent little 'we killed this harmless program because it is made by our competitor- ER... it was a security threat. Right. Security threat.' thing. (Sorry, I break out in insanity every once in a while... biggrin.gif )

My idea is to have it download updates to a game? Would that be possible, because it would be really cool. The other ideas are pretty awesome, too... Looking around at all the stuff you can do with RMVX, you could probably build an OS... Oooh, what a fun idea, until you think about it for a moment.

Sorry, getting off topic. I can't get it to work! Help!

--EDIT--
Got it to work, I have no idea what the problem was. I think it was Vista... Well, whatever, it works!
berka
I'm using vista too !
did you put the last Rgss dll in your project directory ?

berka
masterx
cool but I need to find a way to put it to use
avatarfanatic280
Quick question- can I just go to Event > Script and punch in that Net:: whatever file thing?

--EDIT--
Tried that, I'm getting an error message.

The EXACTLY COPIED error message:

QUOTE
ArgumentError occured while running script.

wrong number of arguments(0 for 1)]


Exact same punctuation.
Here's the code I used:
CODE
Net::HTTP.download ("http://I'm hiding this web address." "./")


Omegas7
Awesome script, and in the right time!!! Thanks a lot.
berka
QUOTE (avatarfanatic280 @ May 6 2009, 04:32 AM) *
Quick question- can I just go to Event > Script and punch in that Net:: whatever file thing?

--EDIT--
Tried that, I'm getting an error message.

The EXACTLY COPIED error message:

QUOTE
ArgumentError occured while running script.

wrong number of arguments(0 for 1)]


Exact same punctuation.
Here's the code I used:
CODE
Net::HTTP.download ("http://I'm hiding this web address." "./")



You have forgotten the "," :
CODE
Net::HTTP.download ("http://I'm hiding this web address.", "./")
acrox999
Nice script Berka. I hope I can see more great scripts from you. smile.gif
darkcloud7867
hi this is my first post so hiiiiiiiii , ok straight to my issue. i got everything working including the download function but ......... how do i close the window after the download is complete. it just stays there permanently. thanks
djrada
hey, I've done the download in ftp =D... but i cant do the upload =\ and its not FTP´s server fault =\...

the upload creates the file in ftp server but named "D" and with 0 kb =\... someone know what is going on? check plz =\

ty =D
SoyaxD
if we are using the Rpg maker vx online script... is it possible to make this script update it then? ^^
NILLO
Hello!
This script is awesome!
I'm using it and it let you do a lot of things!

But I've got a problem :/

I'm using this script to download a page.php that modify some files on the host.
And well, the page.php works, when I try to download it, the php code works fine and the file on the host are modified!
But the game crashes! And I cannot find the page.php in the project directory ohmy.gif
It's not a problem to not find the downloaded file (I don't need it to be in the project directory) but I think that there's a problem in the downloading, the host receive the download request, so it starts the php code in the page.php (this is when the files on the host are modified) but I think that actually the game does not finish (or even phisically starts) to download the file, so the game crashes.
It doesn't show me any error message, it just close the game window!

I use rpgmaker xp version! And the code i type is like this:
CODE
text = 'http://_host_/PHP/page.php?var1='+value1+"&var2="+value2
Net::HTTP.download(text,"./Data/")


What can I do?

==EDIT==
I was thinking about putting some condition like "if the download doesn't start/finish, ignore the download" but I don't know hot to do that! ç_ç
==END==

==EDIT2==
Ok I managed to do it somehow (I made another def named "download2" and I just erased some strings and after some tries, I managed to make the script start the php code on the server and then stop downloading, so now it works quite fine for me) ^^
If you are intersted on what I erased or (and more important) you have some advice to give me, just write everything here *_*
==END2==

Thank you! ^^
lilcooldude69
the rpgmaker vx demo is broken it wont download can u reupload?
deerlittle7
QUOTE (darkcloud7867 @ Mar 24 2010, 11:49 AM) *
hi this is my first post so hiiiiiiiii , ok straight to my issue. i got everything working including the download function but ......... how do i close the window after the download is complete. it just stays there permanently. thanks

yes Mr. berka, this is also my problem, please help us
ASCIIgod
some tips guys... as i see on the same it downloaded the contents in the root. my game has a DLC function so i need the files downloaded go directly at DLC folder. i tried the example './Graphics' to become './DLC' but it just produce the downloaded content with name DLC#file name#... so i thinkered and do this... './DLC/'... and it works... so the tip is to put the downloaded file try to follow the old './Graphics' but do it like this './Graphics/'... always add another / per end of directory
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.