How do I Know when a Dictionary is Loaded?

  • hi everyone,

    I am using "Load Dictionary form Json" and wait "1" sec after it to let it load, i want to reduce the wait time,

    so is there a minimum time in which a dictionary can be loaded so that i don't use wait action longer than necessary?

  • Use the Ajax object which has the condition "On completed", which is triggered when its finished loaded.

    https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/ajax

    or you could do;

    A new system action Wait for previous actions to complete. This is a new kind of wait action, similar to Wait 1 second, but instead waiting for any actions that run in the background to complete. For example the AJAX Request action triggers On complete when it finishes, but now you can put Wait for previous actions to complete after the Request action and then use the data right after that. This means you can do the whole AJAX request in a single event, and you don't need to worry about tags either.

  • AFAIK, Load from JSON is not an asynchronous operation. It is completed in the same tick. Even if JSON string is very big, there will be a lag, but the next action will not be performed until data is loaded into the dictionary. So you don't need any wait at all.

  • AFAIK, Load from JSON is not an asynchronous operation. It is completed in the same tick. Even if JSON string is very big, there will be a lag, but the next action will not be performed until data is loaded into the dictionary. So you don't need any wait at all.

    Wow that's amazing!

    Thank you both for helping!

  • dop2000

    hey what about adding a key to a dictionary? does it completes the same tick too or do i have to wait?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All operations with dictionary keys are completed immediately, you don't have to wait.

  • Wow Great!

    Thanks again for clearing that up!

  • Asynchronous actions are marked with a little "clock" icon in the event sheet. When these actions are finished, they usually trigger "On completed" event, or you can use "Wait for previous action to complete" as mOOnpunk suggested.

    All other actions are completed immediately and you don't need to use Wait.

  • I didn't knew that. thanks!

    hey do by any chance you know about sharing the video recorded by C3 gamerecorder?

    i posted asking about it but i guess no one knows... https://www.construct.net/en/forum/construct-3/how-do-i-8/share-game-recording-145871

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