Been having a play with this as I'm hoping to do something similar in rootin tootin eventually (moving between random screens, but without needing to go backwards). I didn't want to create an extra variable for each room, but did end up creating an extra item for each room, so it's a trade-off. For larger numbers of rooms though, I'd probably find creating items easier than adding in extra variables.
The problem is that Pulp is missing any concept of either arrays or shuffling, so we need to hack it in. Storing a list of values as a row of tiles has been done before, and might work.
My current approach is this:
- Set up random rooms called "room_index_1" to "room_index_X"
- Create item tiles called "index_1" to "index_X" to match the number of rooms. These can be blank, so they get hidden when on screen.
- Have a screen dedicated to shuffling the order and moving between rooms. Script it so that when needed, it automatically inserts the index_X tiles on a "hidden" row, and then loops through to swap them randomly with other index_X tiles. This gives us a randomised list we can jump forwards/backwards between (by just keeping track of an X position on the row as our "current index"), but the screen does either need to be disguised as some kind of "transport" or "loading" screen, or put up with a flash of a screen between rooms.
- When moving to the next screen, just increase the X value of the index pointer, check the tile name (eg "index_2") and then goto the room that matches that index (eg
goto 1,1 in "room_{nextRoom}"
)
The attached JSON is a proof-of-concept with a few comments which may help! It's not perfect, and it'd be interesting to know if it's possible without setting up all the tiles...
random_rooms.json.zip (3.5 KB)