Discuss Scratch

scanredpitches
Scratcher
17 posts

Merge and Sort Two Lists to One

Um, so I kind of found myself in this situation where I have two lists that throughout the game, certain pieces of these two lists need to be put into another list (which is kind of easy) throughout the game, but sorting them is kind of a hassle. Can I get some help please?
GrayCat144
Scratcher
100+ posts

Merge and Sort Two Lists to One

You mean you want to sort a list from least to greatest?
scanredpitches
Scratcher
17 posts

Merge and Sort Two Lists to One

GrayCat144 wrote:

You mean you want to sort a list from least to greatest?
Actually, I want it greatest to least. I want the last list to sort itself whenever it gets a new thing inside it.
awesome-llama
Scratcher
1000+ posts

Merge and Sort Two Lists to One

GrayCat144
Scratcher
100+ posts

Merge and Sort Two Lists to One

Here's my list sorting block.

Last edited by GrayCat144 (Aug. 10, 2025 21:37:10)

scanredpitches
Scratcher
17 posts

Merge and Sort Two Lists to One

GrayCat144 wrote:

Here's my list sorting block.
Thank you, this is exactly what I needed.
scanredpitches
Scratcher
17 posts

Merge and Sort Two Lists to One

GrayCat144 wrote:

Here's my list sorting block.
Thank you for the assistance, but now, if there was a set of names to go with the numbers, I would want to sort the names in the same order as the numbers. How would I do that?
GrayCat144
Scratcher
100+ posts

Merge and Sort Two Lists to One

scanredpitches wrote:

GrayCat144 wrote:

Here's my list sorting block.
Thank you for the assistance, but now, if there was a set of names to go with the numbers, I would want to sort the names in the same order as the numbers. How would I do that?
I'll try to make that for you.
GrayCat144
Scratcher
100+ posts

Merge and Sort Two Lists to One

scanredpitches wrote:

GrayCat144 wrote:

Here's my list sorting block.
Thank you for the assistance, but now, if there was a set of names to go with the numbers, I would want to sort the names in the same order as the numbers. How would I do that?
Done! It's in the same project as my original list sorting block.
10goto10
Scratcher
1000+ posts

Merge and Sort Two Lists to One

Just FYI, GrayCat144’s solution won’t work if two numbers are duplicated in the list. You didn’t share a link to your project so it’s hard to know if that will be an issue or not for you.
scanredpitches
Scratcher
17 posts

Merge and Sort Two Lists to One

10goto10 wrote:

Just FYI, GrayCat144’s solution won’t work if two numbers are duplicated in the list. You didn’t share a link to your project so it’s hard to know if that will be an issue or not for you.
There is only one instance of it, thank you for telling me.
scanredpitches
Scratcher
17 posts

Merge and Sort Two Lists to One

GrayCat144 wrote:

scanredpitches wrote:

GrayCat144 wrote:

Here's my list sorting block.
Thank you for the assistance, but now, if there was a set of names to go with the numbers, I would want to sort the names in the same order as the numbers. How would I do that?
Done! It's in the same project as my original list sorting block.
Thank you so much! This worked, except there is a single instance of a duplicate number with two different names, and in this case, S comes before M, so, reverse alphabetical order. Thanks for the hard work you are putting into this!

Powered by DjangoBB