How do I Clear Ajax.LastData

0 favourites
  • 2 posts
From the Asset Store
Basics sprites and tilesets to build a platformer game or prototype
  • Hi,

    I know the question was already posted here, but the topic was "Solved". Actually it was just closed. I will try to explain what I need to do.

    I have variable and text object which shows the lowest score to beat if you want to get to high scores table (global, from server). When the game starts everything is fine. Request is completed, variable gets the proper score, text object shows what it should.

    So it looks kinda like this:

    SYSTEM -- On start of layout:

    Ajax: Request URL: blablabal "getscores";

    AJAX -- On "getscores" completed:

    System: Set Variable to tokenat(blablabnla)

    TextObj: Set Text to tokenat(blablabnla)

    And then, when player dies, I compare his score with lowest score mentionend above. If it's bigger - then he can upload his score. Up to this moment everything works great

    The problem starts when the layout restarts on my mobile device (Windows Phone 8.1). Score remains the same as it was at the begining (both text and variable). And I see it's trying to request the url as at the begging TextObj shows string "Offline" in case the server is down or player has no internet connecttion. I need to restart app to make it refresh Ajax.LastData

    Any suggestions?

    Sorry for bad english

    Cheers,

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wooohooo! I've found the way around So frikin simple. Duh.

    I just changed url in the action Ajax: Request URL

    from: "http://www.blablabla.com/getscores.php"

    to: "http://www.blablabla.com/getscores.php"&"?"&random(10000)

    Thanks to this additional code, url changes every time Ajax tries to get url (it gets random number from 1 to 10000, so it's pretty unlikely that someone will hit the same number in a row). Because of this, our phone thinks it loads different data every time and doesn't use cache. The trick is that this additional code doesn't affect anything and everybody is happy

    I know i didn't have to put "?" between ampersands, I could put it just after .php and then put one ampersand, but I just did it to remember what I did

    Again sorry for my english

    Cheers!

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