I would like to propose the addition of a new “Level”, called the Library. Here players can create scripts that can be used in any other level.
This way players can define snippets that they might use in multiple places, such as finding the lowest health character in an array. It’s a common idiom, developers working on multiple projects often find it useful to split off commonly used code into a single library they can reuse in multiple projects, and that they can update (to a point) without having to update all their code that uses that library.
It would of course need to act somewhat like a normal level, in order to give players a chance to test their code as they’re working. This means there needs to be a split between library code and test code. Test code would be the same as the code for any other level, meaning that while it persists like other code, it is only available inside the Library level. The UI for this warrants some consideration…