The Daily Click ::. Forums ::. Klik Coding Help ::. download file with ftp object
 

Post Reply  Post Oekaki 
 

Posted By Message

Robbert



Registered
  19/06/2003
Points
  420
24th October, 2005 at 08:07:59 -

For my soccer game (again) I need a feature:

To keep the game interesting for players I need to give them new teams every month or so. I will put those teams in a folder of my webhost.

Players can click the button "look for new teams"
then it connects to the webhost (so far this all goes well, i have read about trouble with this object but not with my pc, while i have xp)

then I set current directory of FTP to "downloads", the folder in which I will put the flags of the new countries...

So I have newcountry.bmp in the folder, and the player has connected to that folder... now the next thing is to download the file newcountry.bmp and put it in the local directory of Appdrive$ + Appdir$ + "data\countries\downloads\"...

but how do I do that? The downloading thing... I tried the file object but I'm not sure whether it can handle with online files.

 
Hey mates, I'm Iglo yeah =P!

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
25th October, 2005 at 04:21:37 -

I don't know, I gave up on the FTP object years ago.

There's an extension available from http://click.spatang.com/ext/view.php?ext=120

...called 'SupaSupa Download'

This can be used to download files from a webserver.

You can have a couple of ways to make this feature work:

Method 1: If you've already managed to get FTP Object to list the files and folders within the ftp directory, save them in a list object.

Each time the player checks for new updates, compare the old list with the new list. You can fastloop through the new list, searching for files with the same name in the old list - using FindStringExact("OldList", getline$("NewList", loopindex("checkNew")), 1)

If that expression returns 0, then that file is not on the Old List, and must be downloaded.

Once this is done, the New List is saved over the Old List file.

Method 2: This is simpler. Make a file in the downloads directory called notes.txt. This will include the filename of all downloads. When you add a new download (like Norway.bmp) then you add another line in this txt file saying "Norway.bmp"

When the player checks for updates, you use SupaSupa download to download the txt file and load it into a list object. Then download the files it mentions.

It would be best if you generate another list at the root of your program which includes all updates you've already downloaded, to compare with.

 
191 / 9999 * 7 + 191 * 7

Crystal Clear (H.E.S)

Possibly Insane

Registered
  06/10/2002
Points
  2548
25th October, 2005 at 05:03:26 -

Also a new Downloading extension has just been release by Herb, it can download from all HTTP servers which SSD can't from what i recall.
http://www.clickteam.com/CTforum/showflat.php3?Cat=&Board=upload&Number=282383&page=0&view=collapsed&sb=5&o=&part=

I havent tried it, but i've tried the SSD object before and i havent had any problems with it, either one should do fine.

 
HES homepage:
http://www.distinctiv-efair.com/heretic/studios
Crystal Clear Productions: http://www.distinctiv-efair.com/heretic/crystalclear

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
25th October, 2005 at 05:19:01 -

Supa Supa Download does not always work, so you could use WebGrab, too.
http://www.clickteam.com/mbfiles2/282383-WebGrab.zip

 
Old member (~2004-2007).

Robbert



Registered
  19/06/2003
Points
  420
25th October, 2005 at 06:03:57 -

Thanks. I'll write those down

 
Hey mates, I'm Iglo yeah =P!

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
25th October, 2005 at 07:31:26 -

Personally, for ArcaneTale, both the FTP Object & Supa Supa Download. FTP Object I used to upload things to my FTP host (Sitesled) & Supa Supa Download to download the file that tracks if updates are needed, & if they are, then download them. So basicly it checked for both the version & if it was out of date, it updated it automaticly.

 
http://www.facebook.com/truediamondgame

Robbert



Registered
  19/06/2003
Points
  420
25th October, 2005 at 10:34:40 -

Well the idea is that people don't have to download a new version of the game, but only a few new countries, they're just bmp files and a new INI file so that the game knows new countries have to be added.

That's it. And there is no need for me to upload these files via the game. I could just do that via a regular ws ftp program, because it's not a feature of the game, only the downloading bit is and goes via the game, hopefully

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
25th October, 2005 at 16:06:36 -

O those flags are only 29x39 or something like that. They take up 4.13 kb each That's not too big now isn't it

 
Hey mates, I'm Iglo yeah =P!

Robbert



Registered
  19/06/2003
Points
  420
25th October, 2005 at 16:24:24 -

Well, Supasupa download didn't work for me, but the Webgrab object did. Thank you all very much!

and to Dines: these methods rock really

 
Hey mates, I'm Iglo yeah =P!
   

Post Reply



 



Advertisement

Worth A Click