Can someone explain lists?

I have never understood how to use them.

I believe @CodeAlpaca knows a lot about them. Me personally, I also know nothing about them but I probably should learn :sweat_smile:

2 Likes

Ah ok, they were always very confusing to me, along with expressions. I have yet to learn them as well.

not an easy thing to explain. they require a lot of experience to get good at. best way to use them is with the split feature in the text behaviour. that lets you split text into a list. then mess around with the other list behaviours until you have the gist of it. best way to prove that you can sort of use them is to make something with them.
Challenge: make a text list that can sort questions and answers

1 Like

Honestly, I do not know where to start.

start by experimenting with the main list behaviour, split up some words using the split input in text then read the help tabs in the lists to learn what everything does

I read it, I still did not understand. I will try my best though.

Lists are pretty tricky at first, but after learning the basics it’s pretty easy. Just think of a list as a Router connected to several Number or Text behaviors

1 Like

A list is a coding structure to help combine several variables together like a package.
For example: (Apples, Bananas, Orange, Grapes)

These can be identified as a number list, where the only values in the list can only be numbers. Or a list can be identified as a text list, where anything can be in the value (letters or numbers). These 2 list types CAN NOT connect with each other, and would be why some green connections will not work.

The way you use a list is different for everyone, I use both Text Lists and Number Lists pretty frequently. I find it a lot more useful for each index (a variable in a list) to combine information inside a text list. But also, text list are harder to work with because everything is in the text format (purple wire).

A List behavior has a lot of inputs, I can list what they do below:

Set - this loads an already made list into the behavior.
Push - Adds a variable at the end of a list.
All - Outputs the list in the list format (either as a number list or text list, both are green).
One - This outputs that index in the list.

  • Ex: 4 → One → (A, B, C, D) → Out → “D”

Pop - Removes the variable at the end of a list.
Join - Outputs the entire list as text, but separated by whatever you put into it.

  • Ex: “/” → Join → (A, B, C, D) → Out → “A/B/C/D”

Find - If the input matches a variable inside the list, it will output the index of that variable.

  • Ex: 4 → Find → (4, 3, 2, 1) → Out → 1
1 Like

My apologies, I think I get what everyone is saying about the basics, but I am not completely sure how I can actually use it.

A list is just to store a bunch of numbers (or text) together, how you use it is up to you.
Both number lists and text lists have a lot of uses depending on what you want to do.
But also, there are many different ways on how you use them.

Number List Example

For example, I used a number list in my Pathway Generator example.
Every other index in this list are X and Y locations the object will move to.
So in my example, this number list looks like this:

 48 #X1
-16 #Y1
 48 #X2
240 #Y2
272 #X3
240 #Y3
272 #X4
 80 #Y4
208 #X5
 80 #Y5
208 #X6
336 #Y6

Anything on the right of the "#" is a note to help show what each part means.
The numbers are the only thing that is actually inside the Number List behavior.

So in this example, I use the list to find where the object moves to next.
The X index can be found by using A*2-1 where A = Location order
The Y index can be found by using A*2 where A = Location order.

What’s the X and Y of Location 4?
X = 4*2-1 = Index 7 = 272
Y = 4*2 = Index 8 = 80

Location 4 = (272, 80)

Link this example: https://flowlab.io/game/play/1812519


Text List Example

For example, I used a text list in my Camera+ example.
It’s set so that an area / room in a format of “X1.Y1.X2.Y2” for each index.
So in my example, this text list looks like this:

# X1.  Y1.  X2. Y2  Area Number
 -32. -96. 864.320 #Area 1
 864. -96.1184.224 #Area 2
1184. -96.1664.224 #Area 3
1664.-224.1984.320 #Area 4
1984.-384.2624. 96 #Area 5
2112.-384.2432.-64 #Area 6
2624. -32.2944.288 #Area 7
3264.-224.3584.-64 #Area 8

Anything on the right of the "#" is a note to help show what each part means.
The numbers are the only thing that is actually inside the Text List behavior.

As I said before, I use text lists very often to store a lot of information. This is a somewhat complex example for Text List, because I use Text List behaviors to create my own data tables. This idea of data tables is also similar to how I made Pack-It! for the last Flowjam. And there are other uses for Text List too, like saving each index as a name for a list of NPC’s. Or like in my “Type your name” example, I used text list to push what paragraph I want to say next.

In my Camera+ example, I would use those numbers to see what rooms the player was in by check each index separately and marking down those areas into a separate number list (because you can make rooms inside of rooms).

This example could have been done with a Number List instead, but it’s easier for me to separate the Rooms in their own indexes. This also makes it where I can’t edit a value for that area without editing the entire area.

Link to this example: https://flowlab.io/game/play/2117959


1 Like

BeepBox