Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Reading files on the web

Author
Message
niansenx
8
Years of Service
User Offline
Joined: 29th Jan 2016
Location:
Posted: 4th Feb 2017 15:23
Hello

I suspect I already know the answer to this, but is it possible to read a text file in from a location on the internet? I've created a game that I want to be able to update with new levels, without releasing a whole new version each time. It would be great if I could just update a text file on the internet and have the game pick it up whenever you start it.

I don't think this is possible. But is there an alternative way?

Thanks.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 4th Feb 2017 15:46 Edited at: 4th Feb 2017 15:49
It is possible.

Check the AppGameKit Challenge thread. BatVink demonstrates a method of reading text from Wikipedia

Here's the link:
https://forum.thegamecreators.com/thread/218129?page=3#msg2591408
AGK V2 user - Tier 1 (mostly)
niansenx
8
Years of Service
User Offline
Joined: 29th Jan 2016
Location:
Posted: 4th Feb 2017 17:33
That's brilliant thanks. I assume this still works even when someone downloads the app from the play store on their device?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Feb 2017 07:30
It works wherever you can read a web page. It uses http to make a link and grab a file.

HTTP is simply a file that you get from another server (it gets more complicated but this is the basic concept).
You can replace the .html file with anything, and it will get it.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
niansenx
8
Years of Service
User Offline
Joined: 29th Jan 2016
Location:
Posted: 5th Feb 2017 15:01
So can you also download images from the web?

And what about writing to the web?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 5th Feb 2017 15:09
Writing to the web is more complicated in that it requires the server to be set up a certain way. It would need some sort of REST api if you're using http calls.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Feb 2017 19:47 Edited at: 5th Feb 2017 19:48
You can get any file, including images using GetHTTPFile(). You store them as you receive them, then open them like any other image.

You can write to the web using SendHTTPRequest() and adding POST data to the request. On the web server, you need to process the received data.
For example:

http://mySite.com/sendHiScore.php?score=1000&name=Player1

In this case, you have to write SendHiScore.php to receive the data and do something with it.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-09-29 23:36:56
Your offset time is: 2024-09-29 23:36:56