Sort variables

WARNING:ONLY DO THIS IF YOU HAVE A BACKUP OF YOUR PROJECT

In my big Mayflower project I have a lot of global variables (please refrain from commentating on that aspect :slight_smile: )

They are in sorted order on the main variables tab

but not in dialogs such as
image

This script fixes that by sorting all global variables into alphabetical order and then deleting and recreating them
reorderVariables

to give
image

Note:

  • The transient status of the variables is lost and they default back to not being transient

Updated as two command blocks - one to re-order the global variables and another one that will re-order the sprite local variables of the sprite it is run in

reorderVariables

I feel like the blocks would look better if you remove "BUT"

Done :slight_smile:
reorderVariables

It looks better, and in my mind, it makes more sense.

I had an idea to reduce the danger of using these blocks :slight_smile:

So now, they make a temporary copy of the variable being processed - then the original gets deleted and recreated - and then the copy is deleted

Using this method, the worst-case scenario is that something goes wrong when the original variable is recreated.

But if it does, then at least there will be a backup copy of it for Snappers to sort out manually :slight_smile:

reorderVariables