How do I call a webservice in the game

Get help using Construct 2

Post » Fri Nov 21, 2014 2:30 pm

Within the game we have questions with multiple answer choices.

When the user selects a radio we want to capture the option and send it to our server and save in a database. This will be done using REST webservices to which i will make an AJAX call. Dont know where to write this function.

Actually we need to capture game analytics. We want to know which user took how many attempts to answer a question in the game.

Please let me know how to do this.
B
4
S
1
Posts: 10
Reputation: 370

Post » Fri Nov 21, 2014 3:05 pm

Hi @dhanalakshmi Just add an AJAX event e.g. AJAX Request url (tag "analytics") and you could also use...
AJAX On "analytics" completed to feed the next question from an external database to keep external control of the question dynamics.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Tue Nov 25, 2014 8:34 am

Hi hundredfold , thanks for your answer...

in construct 2(game) already we're having questions and answers(in construct2 arrays), we're displaying this one by one in the middle of the game, each question having three options.

now, when user clicked on any option of a particular question, we have to pick up that question as well as clicked option and we have to save these both(question & clicked option) in database.

Our concept is to maintain all user's played data in a database.

Please kindly assist us.
B
4
S
1
Posts: 10
Reputation: 370

Post » Tue Nov 25, 2014 4:32 pm

Hi @dhanalakshmi

1) Set up the hosted database.
2) Write your script for adding records.
3) Set up Construct 2 to make an AJAX call to that script whenever a question is answered.

Which part do you need help with?
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Wed Nov 26, 2014 7:13 am

Hi hundredfold,

please see screen-images attached, in that you can see how we displaying question's and answer options randomly.

we calling another file through construct 2 ajax and running that file on particular answer option is clicked, like that we build in construct 2.

that ajax calling file have to run at particular option is clicked, but the problem is that file calling/running multiple time's(like 8-40) when we're playing the game & that particular option clicked.

in that ajax file we placed code to insert values in database, but calling/running multiple times we're getting another problem's.
also is there any way to get that randomly displayed question&options from construct 2 tool to ajax calling file ?, for that we can insert that to database, at the time of when user clicked on particular option.


Please kindly assist us.
You do not have the required permissions to view the files attached to this post.
B
4
S
1
Posts: 10
Reputation: 370


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests