How do I call a webservice in the game

0 favourites
  • 5 posts
From the Asset Store
Medeival & Viking War Horns Sounds / 22 Unique Calls / 2:40 minutes of audio
  • 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.

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)