Help with Ajax, please...

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi, I am working on this game and I need to use Ajax to make file requests. Right now I have 2 text files (.txt) that I have imported. But I can only make one of them work. Is it possible to have 2 Ajax Objects like AJAX1 and AJAX2? Because I can't seem to find a way to do that.

    I have checked the code, the tags are different. I posted a link to a screenshot. This image shows the request that is not working. the one that works is identical except for the fact that I create the text and make the request via a SIGNAL.

    Now this trim(tokenat(AJAX.LastData,random(20,21),";")) is identical in both requests except for the random numbers in the brackets. Could this be it? Sorry I am a noobie.

    The one below (see pic), doesn't work. I tried everything and even ended up creating a button to click on it and see if it would work. I hope I was clear enough.

    Appreciate any help. Thanks.

  • Loading with the action'Request project file' can take a while. It is mostly not ready in the next action. And it can take several tick. That is why you have the condition 'On completed'. The tag is there to know which request pairs with which completion.

    So in general you ..

    Some condition that makes the action done only once (like on startup of layout)

    The action 'Request project file' ("tag")

    A new top level condition 'On completed' ("tag")

    The actions that assign the LastData

    Be aware that, because the loading of files can take several ticks, the rest of your events are not valid. Because the needed data are still missing (not loaded yet).

    I see most people in here use Groups and dissable/enable them. To exclude events from runnning as long as the data are not in place.

  • Loading with the action'Request project file' can take a while. It is mostly not ready in the next action. And it can take several tick. That is why you have the condition 'On completed'. The tag is there to know which request pairs with which completion.

    So in general you ..

    Some condition that makes the action done only once (like on startup of layout)

    The action 'Request project file' ("tag")

    A new top level condition 'On completed' ("tag")

    The actions that assign the LastData

    Be aware that, because the loading of files can take several ticks, the rest of your events are not valid. Because the needed data are still missing (not loaded yet).

    I see most people in here use Groups and dissable/enable them. To exclude events from runnning as long as the data are not in place.

    Thank you. It seems to me that there's something that I am doing thta's wrong.

    See example of what I am trying: http://www.geocities.ws/kikoriogames/AJAX.capx

    In the example there are 2 requests and different text boxes TEXT1 and TEXT2 are to SET TEXT, but only TEXT2 works.

    I am sure there's something I am doing wrong.

    Thanks. Have a happy Sunday!

  • AJAX.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • AJAX.capx

    And I did read a lot about the Dictionary Action I just couldn't get it done! I am fairly new at this. Thanks to people like you I am getting around it.

    Alrightttttttttttt!!!!!!!!!!!!!!! Thank you a lot!!! Neat!!!!!!!!!!!!! Have a great day!!!!!!

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