If all instances var value = 0

This forum is currently in read-only mode.
  • How would I go about doing this? There must be a really easy way I can't think of right now. Check if at any moment the variable value of all instances of an object are equal to a certain value.

  • Can't think of a really easy way at the moment, but here's a comfortable one:

    test_all_instances_match.cap

  • Here's a more simple way: dl.dropbox.com/u/52670878/CheckValues.cap

  • Nice solutions, on both examples.

    tulamide could you explain, how that "isolated" stuff works oO.

    I see 'that' it works, but even after reading the wiki, I didn't get it 'why' it works ><.

  • tulamide could you explain, how that "isolated" stuff works oO.

    I see 'that' it works, but even after reading the wiki, I didn't get it 'why' it works ><.It doesn't work. I couldn't ever get it to work.

    If you try the examples from the wiki, you will see that they don't work. Simply forget about picking in aliases...

    ...at least until rojohound comes along and belies me <img src="smileys/smiley2.gif" border="0" align="middle" />

  • tulamide I haven't used function alias' before so I did some tests and looked at the source to see what it does.

    Isolated/inline act the same as calling a function with forget/remember picking. Any picking done by the alias is forgotten when the alias returns (I initially thought that "inline" would change the SOL of the event that called the alias, but it's not the case).

    Example of use:

    + Function: On Alias "isValue"

    -> Sprite: Rotate 45 degrees clockwise

    //// all the sprites are rotated

    + Sprite: Pick one at random

    + Function: "isValue" (Isolated)

    ////only one is rotated

    + Sprite: Pick one at random

    + Function: "isValue" (Inline)

    Shindoh

    Here is another method using two conditions.

    + Sprite: Value 'test' Equal to 0

    + System: CountMatching(Sprite.OID) Equal to Sprite.Count

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Very interesting, that I am not the only one, who didn't know about that function^^ Thanks R0j0...somehow that sounds corny, maybe because I used that exact phrase too often <img src="smileys/smiley36.gif" border="0" align="middle" /> Dejavu like o.0

    Should make a macro for it.

  • Any picking done by the alias is forgotten when the alias returns (I initially thought that "inline" would change the SOL of the event that called the alias, but it's not the case).Ah, now I see. No wonder I had no success. It's completely the other way round.

    The wiki is awfully wrong at describing the workings. Here's from the wiki (most interesting part in italic):

    "In Inline mode (comparable to Remember), all currently picked objects are passed to the On Alias event, which can then pick other objects, and pass them back to the calling event again. In other words, with Inline aliases, object picking affects both events."

    I was relying on that and never thought in another direction^^

    Thank you, rojohound

    Shindoh

    Here is another method using two conditions.

    + Sprite: Value 'test' Equal to 0

    + System: CountMatching(Sprite.OID) Equal to Sprite.CountNow that's a compact, efficient way to do it!

  • tulamide I haven't used function alias' before so I did some tests and looked at the source to see what it does.

    Isolated/inline act the same as calling a function with forget/remember picking. Any picking done by the alias is forgotten when the alias returns (I initially thought that "inline" would change the SOL of the event that called the alias, but it's not the case).

    Example of use:

    + Function: On Alias "isValue"

    -> Sprite: Rotate 45 degrees clockwise

    //// all the sprites are rotated

    + Sprite: Pick one at random

    + Function: "isValue" (Isolated)

    ////only one is rotated

    + Sprite: Pick one at random

    + Function: "isValue" (Inline)

    Shindoh

    Here is another method using two conditions.

    + Sprite: Value 'test' Equal to 0

    + System: CountMatching(Sprite.OID) Equal to Sprite.Count

    Thanks for the great help, everyone.

    Rojohound, that is definetely what I was looking for. :)

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