Does "Pick" create a scope?

  • When I pick an object, does this create a scope? Meaning, in order to correctly reference the picked object, do I have to put each referencing event/action as a sub-event of the pick? Or will any subsequent event (just following, not in a sub) have a correct reference to the prior picked object?

    Thank you for clarifying :-)

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The next event at the same level, will break picking. Even if the picking event was a sub event, the next sub event at the same level will break picking.

    The only exception is when you create an object. Then both objects are picked.

  • Ok newt, let make sure I follow you:

    You're saying if I pick an object, then pick same or any other object at same level this "breaks" picking. What does "break" mean specifically? Does "break" mean: Each pick at same level cancels (un-picks) any prior pick? So if I pick in subevents, I will not break the prior pick?

    So like...

    Pick ( SomeObjectA ) by-whatever

    ---- Pick ( SomeOtherObject ) by-whatever

    -------- Pick ( AThirdObject ) by-whatever

    ------------ In this pick subevent I will still have all 3 objects picked

    But if I do above like this...

    Pick ( SomeObjectA ) by-whatever

    Pick ( SomeOtherObject ) by-whatever

    Pick ( AThirdObject ) by-whatever

    ---- In this pick subevent I will have AThirdObject picked, but break/lose the first 2 objects picked?

    I'm assuming if you ever (regardless of same level or subevent) pick same object again, you lose the prior pick. Yes?

    Thank you for helping my friend! :-)

  • Also, nearly all of my "code" is in functions. Does this make a difference?

  • It means the next pick at the same level will remove the last from the sol, and then default to the zero index if referenced again.

    Also, functions always break picking. You have to re-pick in the function call using an id in a param.

    Then again Ashley is doing some refactoring on the plug, so that may change soon.

  • Yes I am sending in a UID to re-pick in the function. I would not expect a function to see any external picks.

  • It means the next pick at the same level will remove the last from the sol, and then default to the zero index if referenced again.

    Also, functions always break picking. You have to re-pick in the function call using an id in a param.

    Then again Ashley is doing some refactoring on the plug, so that may change soon.

    What is "sol"?

  • The selected objects list.

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