How to create Clean Code - CodeAlpaca

Pretty good, some small notes

  1. I wouldn’t use “.” as the connector for the the Number List, because you can have numbers with decimal places. (Use something like “,” or “/” or “|”, etc.)
    Also, you’re listing each value from it and separating it when “.” is detected because you previously transformed the Number List to a Text List. Instead of doing that, you can use the “Split” input on Text to convert it to a Text List, then List Each value and use Text to Number.

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":1,"outputCount":1,"name":"Text List > # List","behaviorType":"logic.NodeGroup","x":630,"y":-64,"group":"64c83387927c7a46","id":"64c8338aaffa2d4b","isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-450,"y":-160,"group":"64c8338aaffa2d4b","id":"64c8338ad8fd4e45","portId":"64c8338aaffa2d4bi0","tag":"Text","dataType":1},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":630,"y":-160,"group":"64c8338aaffa2d4b","id":"64c8338a2bf80d44","portId":"64c8338aaffa2d4bo0","tag":"# List","dataType":3},{"inputCount":5,"outputCount":2,"name":"Text","behaviorType":"logic.data.TextBlock","x":-270,"y":-128,"group":"64c8338aaffa2d4b","id":"64c8338a042b6b41","startVal":","},{"inputCount":5,"outputCount":2,"name":"Text","behaviorType":"logic.data.TextBlock","x":-90,"y":-160,"group":"64c8338aaffa2d4b","id":"64c8338ac7e1e14b","startVal":""},{"inputCount":1,"outputCount":1,"name":"To Number","behaviorType":"logic.data.ToNumber","x":270,"y":-192,"group":"64c8338aaffa2d4b","id":"64c8338a8f6aae4f"},{"inputCount":7,"outputCount":5,"name":"Number List","behaviorType":"logic.data.NumberList","x":450,"y":-160,"group":"64c8338aaffa2d4b","id":"64c8338a28ead047","startVal":[]},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-540,"y":-64,"group":"64c8338ae1031a4a","id":"64c8338ab654f641","portId":"64c8338ae1031a4ai0","tag":"Reset","dataType":3},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":180,"y":-64,"group":"64c8338ae1031a4a","id":"64c8338a9d00ff43","portId":"64c8338ae1031a4ao0","tag":"Blank","dataType":3},{"inputCount":1,"outputCount":1,"name":"Number List Count","behaviorType":"logic.data.ListCount","x":-360,"y":-64,"group":"64c8338ae1031a4a","id":"64c8338a61c9a541"},{"inputCount":7,"outputCount":5,"name":"Number List","behaviorType":"logic.data.NumberList","x":-180,"y":-64,"group":"64c8338ae1031a4a","id":"64c8338a47c1c24f","startVal":[]},{"inputCount":1,"outputCount":1,"name":"Number List Order","behaviorType":"logic.data.ListOrder","x":0,"y":-64,"group":"64c8338ae1031a4a","id":"64c8338ada75f94d","mode":1,"copy":true,"numSort":false},{"inputCount":1,"outputCount":1,"name":"Reset List","behaviorType":"logic.NodeGroup","x":450,"y":-224,"group":"64c8338aaffa2d4b","id":"64c8338ae1031a4a","isMenuItem":false},{"inputCount":1,"outputCount":2,"name":"Text List Each","behaviorType":"logic.data.ListEach","x":90,"y":-160,"group":"64c8338aaffa2d4b","id":"64c8338a37b6f344","delay":0}],"links":[{"input_id":"64c8338ac7e1e14bi0","output_id":"64c8338ad8fd4e45o0"},{"input_id":"64c8338a042b6b41i1","output_id":"64c8338ad8fd4e45o0"},{"input_id":"64c8338ac7e1e14bi4","output_id":"64c8338a042b6b41o0"},{"input_id":"64c8338a37b6f344i0","output_id":"64c8338ac7e1e14bo1"},{"input_id":"64c8338a28ead047i1","output_id":"64c8338a8f6aae4fo0"},{"input_id":"64c8338ae1031a4ai0","output_id":"64c8338a28ead047o0"},{"input_id":"64c8338a2bf80d44i0","output_id":"64c8338a28ead047o0"},{"input_id":"64c8338a61c9a541i0","output_id":"64c8338ab654f641o0"},{"input_id":"64c8338a47c1c24fi2","output_id":"64c8338a61c9a541o0"},{"input_id":"64c8338ada75f94di0","output_id":"64c8338a47c1c24fo0"},{"input_id":"64c8338a9d00ff43i0","output_id":"64c8338ada75f94do0"},{"input_id":"64c8338a28ead047i0","output_id":"64c8338ae1031a4ao0"},{"input_id":"64c8338a8f6aae4fi0","output_id":"64c8338a37b6f344o0"},{"input_id":"64c8338a28ead047i2","output_id":"64c8338a37b6f344o1"}]}}}

That’s how I typically do it.

How you did it

  1. Probably don’t need to read the Save constantly every frame, should realistically only get it when you’re editing the data

If you want to do this for a Text List as well, it’s pretty simple.
Each Index is a Text List. Then just separate values with a character or combination of characters that won’t be used like “|Break|”, and assuming that isn’t a value in the Text List, it works fine. There is probably also a character you can use that can’t be typed on keyboards as well.

1 Like

Oh! I didn’t notice that, thanks!
Your system makes much more sense, thank you for helping me!

Also, is there a way I can get rid of the ‘copy’ in this ‘list modify’ for the game performance?


It seems to work without it?

I think I had that there because if you repeatidly do stuff with the list, it starts setting that Number List for some reason. Though that might have been due to specific things I had after the system

1 Like

Yeah, I think you are right. I had that happen with the first prototype. Is it just a flowlab bug?

1 Like

It’s not a Flowlab bug, it’s because the system handles each List from the same List. So if I set 10 Number Lists with 1 Number List, the engine treats it as 1 because it’s a lot more effective. With Copy Before Modify it clarifies that you don’t want those Lists to be grouped as the same.
So it’s working as intended, just confusing to understand it properly. I was very confused when this first happened to me lol

1 Like

Oh, ok! I think I understand! Thanks so much for your help, I really appreciate it!

2 Likes

Here’s an additional tip that I’ve been following for years that applies to when you should probably start bundling: if you can view the entirety of a function’s code in a single, fully zoomed view, then it’s probably well-bundled. If you need to start zooming out a lot to see everything, then you probably need to start bundling things better.

This simple ideal just makes my code just feel so much cleaner and quicker to navigate

6 Likes

I bundle by system. I don’t want to keep two pieces of separate code in one bundle, unless they’re related.

omg thx so much my code is so messy I cant even read it.

1 Like

When people revive old topics:
:skull: :skull: :skull:

1 Like

nah we all established it’s fine now as long as it’s not off-topic

2 Likes