Fellow Critters,
I’ve created a generic list manager script that allows you to decouple list data from your room scripts. This addresses two key pain points:
- Script size limits - Helps keep your scripts under the 20k character limit by moving descriptions, events, content data out of the code.
- Reusability - Separates room-specific content (events, puzzle solutions, descriptions) from script logic so you can deploy the same script everywhere.
How it works:
First, I deploy the list manager script in a room, which gives me commands to create and populate lists in that rooms persisted state:
list new maze_descriptions
list push maze_descriptions "You find yourself in a twisting corridor of stone..."
list push maze_descriptions "The passage opens into a small chamber..."
list push maze_descriptions "Strange markings cover the walls here..."
list new maze_solution
list push maze_solution "n"
list push maze_solution "e"
list push maze_solution "w"
lists
Available lists:
maze_descriptions (3 items, 139 chars)
maze_solution (3 items, 9 chars)
Total: 2 lists, 6 items, 148 characters
In my actual room scripts, I can then use minimal helper code to consume the data:
// Minimal helper (6 lines)
const LIST_PREFIX = "list_";
function getStoredList(name: string): string[] {
const data = Store.getString(LIST_PREFIX + name);
if (data == null || data == "") return [];
return JSON.parse<string[]>(data);
}
// Usage examples
const description = getRandomFromList("maze_descriptions") || "Default description";
const solution = getStoredList("maze_solution");
Benefits:
- Scripts become pure logic, content lives externally
- Easy to update descriptions/content without redeploying scripts
- Could enable script sharing with standardized data interfaces
- Manages storage efficiently with JSON serialization
Is anyone else doing this kind of approach? Any issues I should be aware of?
It seems like standardizing storage of simple data structures could really help with script reusability across different rooms/realms so perhaps this kind of functionality should eventually come ‘batteries included’.
If there’s interest, I’m happy to share the full list manager code or give it to the community to include in the mucklet scripts repository.
Heyho,
Fuzzer.