• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 Highscore store online in table, how?

L

Lianne

Guest
I have created the highscore table in a mysql database.
How can I use this in my Gamemaker studio 2 game?
Please explain me in detail where and what I have to do within Gamemaker.

It should work in Gamemaker studio 2!
 
L

Lianne

Guest
I dont understand it at all.

Please describe (with coding examples) where I code what?

In the mysql database I have made a table called Highscore.

How do I store the highscore in this table?

How do I restrieve the highscore from this table?

We need to make a connection to the mysql database. How and where in Gamemaker studio 2?

Please help...
 
L

Lianne

Guest
I dont understand it!

Regarding the link:
http://gmc.yoyogames.com/index.php?showtopic=618624#entry4548625

Where do I place the PHP code Gamemaker Studio 2?
"Here is a basic PHP page that reads from a database with GET parameters"

Where do I place the request within Gamemaker Studio 2?
This will initiate a request to the page for the user "Alice":

Where do I place the HTTP event within Gamemaker Studio 2?
To see the result of the request, use the HTTP event:

Etc..

Please explain me step by step where to place what?
 

The-any-Key

Member
Where do I place the PHP code Gamemaker Studio 2?
PHP code is stored on the webserver where you have your SQL database.

Where do I place the request within Gamemaker Studio 2?
In GMS2 when you want to get the data from the webserver. Ex when you want to show the list in the game you click on a button say "highscore". When click highscore you send a request to the webserver.

Where do I place the HTTP event within Gamemaker Studio 2?
In GMS2 in an object. This event trigger when the webserver has got the request and will now send back info to your game. The result will end up in the http event. When result is back you can place it in a list to show it in your game.

Note if you want to connect to a local database you need to setup ex Wamp on your computer.

There are some free examples on the marketplace:
https://marketplace.yoyogames.com/assets/4205/online-highscores-example
 
Last edited:
L

Lianne

Guest
I have created the .php scripts and uploaded them to the server, BUT?

Where do I place the http_request () en http_get () in Gamemakerstudio2?

Where do I pass the username?


In obj_Player I have put the http_get:
this object whenever it dies. it will save total highscore
if(global.healt <=0){
audio_play_sound(s_gameover,1,false);
room = r_Highscore;
http_get("http://www.klasjeapart.nl/paasspel/top_scores.php?username=Alice");

In obj_Highscore I have put the code http_post_string:
this object should show the highscore
if(keyboard_check_pressed(vk_enter)){
submission_request = http_post_string("http://www.klasjeapart.nl/paasspel/submit_score.php", "username=Bob%20Brown&score=3755");
game_restart();

Can you help me?
I am already busy with this problem for 2 weeks....
 
Top