How to 'loop' through multiple opjects to access data

Hi there, oh mighty Keepers of Wisdom & Knowledge.

To get the hang of Flowlab I thought I start by making a little dice game, hands on challenges are always the best to learn.
I have no problems to set up the animations or to spawn the dice, BUT … I need some good pointers how to do it right so that I can actually access the different dice results.

In a ‘scripted’ world I would have probably used an array to store the results and looped through it to get what I need. Any examples out there to point me in the right direction?

https://flowlab.io/game/play/1349870

Cheers & Kia Ora from the bottom of the world :slight_smile:

What is the end goal that you have in mind? What do you want to happen with the dice results?

Challenge I set myself was to do a simple dice game like ‘Ship, Captain & Crew’
https://en.wikipedia.org/wiki/Ship,_captain,_and_crew

or easier description here: https://everything2.com/index.pl?node_id=1091407

So 3 rounds of rolling.
Round 1:

  • roll 5 dice
  • check for 6, if found set ‘ship’, remove dice
  • if 6 found check for 5 in the rest of dice
  • if found 5 set ‘captain’, remove dice
  • If found 5 (after found 6) check the rest for 4
  • if found 4 set ‘crew’, remove dice
  • next round (minus the dice that have been found)

I am used to scripting, but this is the first time I use a flow based system. I see it requires a completely different approach, so my apologies in advance :slight_smile:

My initial idea was to ‘somehow’ look through the dice thrown and to action accordingly. I have a suspicions it won’t be that easy and might have to create multiple levels for the different outcomes.
I still have not found a way to store the dice results in some kind of array or list. The problem is, I can’t evaluate the result as each dice is thrown, the 5 might show up before the 6. SO I somehow need to be able to look ‘back’ to previous results (I hope I make sense).

Reminds me, I have seen someone using the Evaluation block to print out characters one by one out of a list. Looks like he fell back to scripting there :slight_smile:

Thanks for looking into this, by what I have seen so far Flowlab is such a great product with enormous potential. Great Job.

Afterthought:
If at least I could access the 5 results at once I could create a custom ‘logic gate’ block for it … yikes

The final dice game I have in mind has 13 dice … LOL

Found the array thingy …
http://flowlab.io/game/view/936837

But I have the suspicion that array is not global?

So one can use arrays? Sort off … Show me the ways :slight_smile:

Ufff … @grazer , I so hope at some stage custom variables, lists or arrays will be available :slight_smile: Would open up so many new game play options, Card games, board games, dice games dreaming

Investigating other games that tried to do the same I see I would end up with behaviour pages that cover half a square mile horror if I have to fake a table using the available functions.

Not given up yet, question, is there an easy way to see what animation frame the object is at? That way I could use a proximity ‘scanner’ to go over my dice as often as I please and evaluate the results.

Maybe a nice option to add to the ‘Extract’ block?

Cheers :slight_smile:

Hey @TinkerSmith - the embarrassing truth is that there is really not a good way to track and manipulate lists of data like that.

I have some things planned that might make it a bit easier, but your best bet right now would probably be to have the dice send their scores to a central score object that compares the dice and removes the ones that are found, probably by sending them a “found” message back that triggers a Destroy block.

Hmmm, I need to have a play with that. Thanks for looking into it :slight_smile:

That works for this scenario @grazer , thank you for pointing me into the right direction.
Here what I got so far : https://flowlab.io/game/play/1349870

So far it only picks the 5 and 4 in the same roll when they appear AFTER the 6. I guess I could get away with it if I would delay their messages to make sure the 6 gets evaluated first. Too tired now but I will try later :slight_smile:

Tell me about those ‘things’ that might make it easier, as mentioned my final game idea would involve 13 dice, LOL, that would be a nightmare this way :slight_smile:

Update … the timer delay trick works, now it picks them right :slight_smile:

P.S. this is a preview of something I started where I used lists to sort through the results:
https://tinkersmith.itch.io/box-battle?password=eternalfun

Still just the interface test, rules and multiplayer to be done.
And for sure I have to change the Gfx, the FF theme was for fun. Just give you an idea :slight_smile: