Send initial data to game

Get help using Construct 2

Post » Thu Sep 27, 2012 3:01 pm

I'm sure this has been covered elsewhere in the forums - I just can't find it.

Is there a way to load a game with some external data already - such as putting a get string in the url, etc.? (or send data to the game without an AJAX request?)

I have a game with a settings that is determined on the server. I want to be able to send that setting to the game when I load it, so that the game will know what to ask for when I do an AJAX request

Here's a simplified version of what I'm looking for

1) The server picks a random number from 1-5

2) It sends the number (3) to the game

3) The game sends sends an AJAX request back to the server with the number 3

4) The server looks up in the database...If this user is 3 today, his color is blue.

I hope it makes sense...thanks for the help
B
12
S
3
G
4
Posts: 55
Reputation: 3,186

Post » Tue Feb 12, 2013 9:57 am

I am bumping this thread because I have a very similiar issue.

I want my game menu to be a HTML/PHP Website. The player should choose the level he wants to play and some other options (Units,etc.) on the website.

When the player clicks on the play button the website should pass Post/Get Parameters to the game which then decides which Layout and Event Sheet to load.

Well, is this possible? And how?
B
15
S
4
G
2
Posts: 16
Reputation: 2,129

Post » Tue Feb 12, 2013 10:39 am

Im not understanding your problem.

On Start of Layout
AJAX Request -> php file
AJAX oncompleted
    Goto Layout: Ajax.LastData Ajax Wikilocalboss2013-02-12 10:44:10
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Tue Feb 12, 2013 10:48 am

I know how I can request data within the game.

I try to explain better:

The player is on the website of the game (the game is not loaded, the website is a stand alone HTML page!). He chooses some settings. After choosing them he starts the game by clicking on the "Play Button".

I load the game after he clicked on the play button but I need to pass the settings he made. After the game finished loading it needs to get the passed data and choose which layout to load.
B
15
S
4
G
2
Posts: 16
Reputation: 2,129

Post » Wed Feb 13, 2013 1:52 pm

Well, I decided to store the settings made into web storage (session storage) and to load it from there.
B
15
S
4
G
2
Posts: 16
Reputation: 2,129


Return to How do I....?

Who is online

Users browsing this forum: Matthew de, Yahoo [Bot] and 28 guests