Detecting Image Instances in a List

supremelorax

  • Posts: 24
Greetings friends,

Would:
If 'list' contains 'instance of (image)'
trigger anything or am I missing something to make this work?

Thank you.

Luyren

  • *
  • Posts: 2245
You'll have to test it. Lists can contain anything within them. If that doesn't work, you could try using an image instance attribute when adding and checking if it is in the list.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

supremelorax

  • Posts: 24
Thank you Luyren. The only thing about image instances, wouldn't that be like looking for one actor in a sea of actors.
I just want to know if any actors are there. If a specific isn't there it would return a false.

The other thing I am working on in this code is finding regions on a list. I saw a post from a while back about:
For Each 'actor of group': Regions
add 'actor of group' to 'list'
Any confirmation on this working? I am still working through various combinations but would love an earlier confirmation.
I know they can be added manually but... that ins't preferable.

Luyren

  • *
  • Posts: 2245
Is the order of the elements important? Because if it is not, you could use maps instead of lists, and just check if the map has the key you want. The value of your key could then be your image instance or region.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

supremelorax

  • Posts: 24
I don't have much experience or knowledge about maps, so I am working on changing that now.

Basically I have image instances that are moving back and forth between two lists and being moved to certain regions. One list must remain in order. The second is in order of placement from the first list. Sort of like a bus with two rows of seats. One row keeps tracks of everyone in order. The second row, anyone can sit anywhere, but remembers their first seat if asked to go back. Then they can change their seat in the second row if they like. This is all happening on four simultaneous sets of these lists.

So far... no go on detecting an instance in a list. I can keep trying a few things though.

Might there be a way to add regions to a list by using their name and some creative attributes? They are consecutively created so it is region14, region15... I feel like I could loop this easily if I can find an acceptable way of changing the number in the name by one each time.

Luyren

  • *
  • Posts: 2245
Now that I think about it, instead of checking for the image instance, you can just check if the list has the item number you want (or you can check if the item on that index is not equal the "null" block, under Flow > Advanced).

As for adding regions, you'd need to find the code to reference specific regions by their names, and I don't know that specifically. But one thing you could do is create all your lists from within the code (either from a non-hidden list with their dimensions and coordinates, or by looping and multiplying their position to make a grid of fixed sized regions), and just add "last created region" to the list after creating each one.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter