How do I pick several UID instances at the same time

0 favourites
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • RenatoB , yet another way would be to push the uid you want to check in an array, then for each x, pick uid at array.at(curx) and compare whatever

    vtrix

    But I continue to use UID and in a more complicated way. For me the best would be to use the first blackhornet solution because I need to manage 6~10 instances only:

    Pick instance by evaluating instance.UID >=0 && instance.UID <=3[/code:2600ry1n]
    
    I changed to :
    
    [code:2600ry1n]Pick instance by evaluating instance.UID=0 && instance.UID =3 && instance.UID =5 && instance.UID =9[/code:2600ry1n]
    
    But the program does not accept && for this command.
  • RenatoB did you actually try this condition, i think you can combine picking like this / edit: nope you cant

    pick sprite instance 0

    pick sprite instance 7

    pick sprite instance 5

    you could make them variables and update the numbers when needed

  • RenatoB did you actually try this condition, i think you can combine picking like this / edit: nope you cant

    pick sprite instance 0

    pick sprite instance 7

    pick sprite instance 5

    vtrix,

    I had tried this. BTW, was my first idea.

    you could make them variables and update the numbers when needed

    Okay. It seems that there is no other way.

  • As I said yesterday, I had to use a variable ("register") to distinguish the frames and got the same problem I had with the UIDs. If I click on a square and the frame is correct, the value of the variable "squareRight" is changed. To change this variable is necessary that all the squares with the variable "register" =1 have been selected.

    Below is the code I used but that does not work

    Event: Pick all square
    Sub-event: Pick square where square.register=1
    Sub-event: Animation frame = 3
    Action: Set squareRight to 1[/code:1tgguz44]
  • Some light, please.

  • RenatoB

    regarding multi uid select

    reading up on expression the OR expression adds to selection

    pick sprite by evaluate

    Sprite.UID= 1 | Sprite.UID= 2 | Sprite.UID= 3 do something works..

  • Hi vtrix

    Actually I need to use AND instead of OR because all instances must be in the same frame to proceed. I cannot understand why the "pick by evaluate" does not accept AND (&&).

    Thanks anyway.

  • RenatoB, thats exactly what it does it picks all the instance in the same event that are evaluated in the expression

    the same what you want to achieve with the && (i think c2 only uses &, even for expressions)

    maybe an example showing you is more clear

    https://dl.dropboxusercontent.com/u/61666915/multipick_UID.capx

    i got the idea from this paragraph in "Guide to Construct 2's advanced event features"

    [quote:1hfuj7k2]Note how in ordinary 'AND' blocks, subsequent conditions filter out instances not meeting the event - progressively reducing the number of picked instances. In contrast, 'OR' blocks add instances meeting the event - progressively increasing the number of picked instances.

    working directly with "or" blocks wouldn't work, but by using the evaluate it does..

  • vtrix

    Thanks for continuing to try to help me.

    It really works this way that you built in your example. I had already tested this way. But it is not work for my purpose or maybe I'm doing something wrong. I used your file to simulate part of my project. Suddenly you can see something I'm not seeing.

    https://www.dropbox.com/s/ihabm5603qhbv ... anged.capx

    In this example, the correct would be to click on the 03 instances that the word "OK" to appear in the yellow box. But you simply click on one of the three instances that the word appears.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In this case you can add the extra condition: Sprite.PickedCount = 3. This tells you that there are three items picked, that match the criteria.

  • To make it exclusive, pick all with frame=1, then check that only the ones your care about match in count.

  • Thanks It really works.

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