How do I debug dictionary keys all return 0

0 favourites
From the Asset Store
Piano Keys
$3.99 USD
A musical typing game where the goal is to play a song by pressing the matching keys as fast as you can!
  • Also please remember to rate and review C2 Data Editor in the store!

  • Ok look at this CAPX and pay special attention to how

    1) I created a Dictionary

    2) Saved the UID for the Dictionary

    3) Re-"picked " that same Dictionary by UID later on and got its data

    There are other ways of doing things but this is how I always do it... basically in my mind the UID is a pointer to a specific instance like in C++ coding.

    https://dl.dropboxusercontent.com/u/277541264/ShowDictionaryWorking.capx

    [attachment=0:2wt08x6f][/attachment:2wt08x6f]

    Here comes my weird question about scope, and hopefully this is what I'm being tripped up on (I have implemented this yet, but purely in terms of the environment):

    If I only have one Dictionary object, wouldn't

    Dictionary->PickbyUID

    Dictionary(0)

    or Dictionary

    All yeild the same results when picking?

    I made your example look more like mine and you're right, it broke. Am I understanding how it picks incorrectly? Sorry to bug you The question is open ended to anyone

  • The picking system seems somewhat complicated and I think that it might be context sensitive. I got tired of trying to use picking in different ways and now I use UIDs for everything. So I really cannot answer your question about how picking works in every situation. I just know if you standardize on UIDs it always works (Except when you forget to pick an object by UID before using it)

  • The picking system may be a little complicated, but if you only have one instance of an object type, you don't have to worry about it at all.

    EDIT:

    Actually, I was just reminded of a certain behavior that might be tripping you up. If you create an object, and then in a different event on the same tick, try to use an action on it, it won't work unless you had picked it by UID. All other forms of picking don't work properly for objects that were created in the same tick.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Actually, I was just reminded of a certain behavior that might be tripping you up. If you create an object, and then in a different event on the same tick, try to use an action on it, it won't work unless you had picked it by UID. All other forms of picking don't work properly for objects that were created in the same tick.

    That's why I had wait 0.0 before. Waiting for the next frame pushes the object into scope.

    Thank you so much ggibson1 !! That fixes it. For some reason picking does not work as I thought it should under the context, and although I'm not sure "why" picking is being weird, selecting by UID does fix it and makes everything work as normal! Thank you!

  • Thank you so much ggibson1 !! That fixes it. For some reason picking does not work as I thought it should under the context, and although I'm not sure "why" picking is being weird, selecting by UID does fix it and makes everything work as normal! Thank you!

    This behavior feels like a bug, so I made a report.

  • >

    > Thank you so much ggibson1 !! That fixes it. For some reason picking does not work as I thought it should under the context, and although I'm not sure "why" picking is being weird, selecting by UID does fix it and makes everything work as normal! Thank you!

    >

    This behavior feels like a bug, so I made a report.

    Ashley wrote a post about this. I call it scope, but the post gives a better description

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