3DDelfin's Recent Forum Activity

  • You should not use "Get" without checking if the item exists. The correct code is:

    > On start of layout -> Local Storage Is "PistolLVL" exists
    
    On "PistolLVL" exists -> Set PistolLVL to LocalStorage.ItemValue
    

    This doesn't explain the 5s delay though, there must be something else in your code.

    i had problem like this and it solved after re-writing big chunk of the code by looking at photos. I just was watching either how to solve it or make a "kludge" so it will work somehow even with stupid code

  • You should not use "Get" without checking if the item exists. The correct code is:

    > On start of layout -> Local Storage Is "PistolLVL" exists
    
    On "PistolLVL" exists -> Set PistolLVL to LocalStorage.ItemValue
    

    This doesn't explain the 5s delay though, there must be something else in your code.

    Didnt know that. Thank you! Yes it doesnot explain. The other part that i dont show is list of included arrays,there is no need to show them i think. Also pay attention to that this is a "Floating problem" (in my language idk how to translate it correctly)

    in short just to remind you: coins are slow,shotgun is ok. If you delete coins,then shotgun is slow but shotgun remains untouched,while pistol is ok

  • > I wrote it in text ----> on event complete- load load load load

    There is no "On event complete" in Construct. And there is no "Load Load Load" action in Local Storage plugin. It's not a bug, I've seen problems like this many times on this forum. Your code is wrong, good luck fixing it.

    You guys already helped me. Thank you all! I wrote like this because i dont think there is difference in which one event was complete, as well as UE thinks so too, by placing on "on event complete" node. Its just means it is triggered.

    Here is the code and thats it. The only difference is that it is made for every gun and it is identical and also coins text is set on localstorage.itemvalue (when get localstorage.coins)

    That is it with localstorage expressions and i don't know where is my code wrong, cuz nothing changes when u place wait till asyn. actions are done.

    And as i have already mentioned - removing get coins( as on screenshot) makes get shotgunlevel load for 5 seconds, like get coins was, before removing.(get shotgunlevel was working fine before i deleted get coins)

  • it clearly looks like a bug because after deleting localstorage.coins problem starts to appear on localstorage.shotgunlevel, where everything was working fine before deleting localstorage.coins

  • > So, in short i removed action "get localstorage.Coins" from the game almost at all and now coins are working fine.

    Do it for all then.

    Tip: Dop2000 is really helpfull in this forum , he know better than us so if Dop say somewhere in your code you are doing something wrong then you do.

    If you do not want to share all the project you can screenshot the parts you use the localStorage and share it.

    I wrote it in text ----> on event complete- load load load load. Watch in the first message it is it,nothing more with gets or something.

  • Local Storage is not slow. Even if you are saving/loading dozens of keys, it should only take a fraction of a second. If it takes 5 seconds, this is a clear indication that you are doing something wrong. As other people have said, you should post your code.

    It's slow only on mobile devices.There is no need to post the code,because its already mentioned in the post. Yes, its that simple.

    Now i've done that coins stores in dictionary. On start of the game, when localstorage.Coins is instant like "fraction of a second" it loads amount of coins and stores it in dictionary.get("Coins") and this works fine now. So, in short i removed action "get localstorage.Coins" from the game almost at all and now coins are working fine. Localstorage.coins are being written only couple of times and that makes it for coins in my game. Now finally player doesnt need to wait 5 seconds for coins to load. Now he needs to wait 5 seconds to load level of his shotgun... Why? It was instant before i removed action "get localstorage.coins". The other interesting part of this case is that all processes for each gun are absolutely identical and only shotgun is loading that long.

    If i switch to previous project save - it will load instant but "get localstorage.coins" would be slow.

    I will repeat, that shotgun events were untouched.

    It doesnt make any sense for me

  • I just notice you say there is not delay on start of layout.

    So this is the key, there is no need to load every time your score/level/coins change.

    Just do it once the player open your game and add a dictionary to hold your variables while the users play your game.

    So if a level end and you collect 100 coins, save the coins to your local storage but not load it back,just save it and to a dictionary and continue the game with the dictionary values.

    Now, as blackhornet say its better to use a dictionary to have only one save/load. And this is up to you if you want to have a game and run with no issues then you have to change your code and add the dictionary.

    Thank you, I was thinking about this too while sleeping. I will try this today and leave a report

  • You have this issue at the first run?

    When you open your game for first time, coins are take too long to load?

    No, when it was edited after game

  • Don't store the data separately, it just makes life awkward. Use a dictionary and save the JSON and load it back. Then there's only one load/safe.

    Sounds reasonable,but that will make me re-do all the code. Im searching for a kludge right here. The interesting part here is that even if ONLY coins are getting loaded - they are loading for too long in comparison, like Localstorage.Coins is cursed by an evil magician

  • You can specify your problem more by giving the viewers more information so that someone visiting this post can help u better(but not me,i know nothing). Tell us more.

    I already said enough,sorry to say that,but you are making that worse,because less and less people will read all of that because its getting bigger and bigger

    Thread looks full like it was solved

  • Also if coins are loading instantly if you try to load them on start of the game, but once you change coins value during play and try to load them again-it will take a while

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you saved the game in local storage?

    Local storage load might be slow then.

    As i already said, its numbers of levels from 0 to 6 and number of coins. Numbers of levels are loading instantly, while coins are loading longer then 5 seconds on mobiles(including bluestacks),while on PC everything is instant(nws)

3DDelfin's avatar

3DDelfin

Member since 10 Feb, 2019

None one is following 3DDelfin yet!

Trophy Case

  • 5-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

7/44
How to earn trophies