david-pfx / PuzzleScriptNext

A direct successor to PuzzleScript, building on the work of PuzzleScript Plus, Pattern:Script and others.
http://www.puzzlescriptnext.polyomino.com
MIT License
12 stars 4 forks source link

Allow link destination to be defined in rule instead of LEVELS section #81

Open Draknek opened 1 month ago

Draknek commented 1 month ago

I'm suggesting an optional argument to the link rules command

late [ Player links ] -> link is the current implementation, and triggers the link, sending you to the level defined in the LEVELS section

late [ Player links ] -> link levelname would trigger the link, sending you to the level called levelname even if the current level doesn't have any links defined in the LEVELS section

Use case: I made a game with PuzzleScript Next with lots of levels, many of which are quite hard. The ideal structure for this game would be a hub world which lets you play them in any order, but doing this in the LEVELS section would mean having 20 unique objects, which feels a bit unwieldy. Doing it in a rule would potentially be a bit simpler, i.e. I could put the level entrances in a line and do something like this:

right [ Level_A Player | Level_A | Level_A ] -> link A1
right [ Level_A | Level_A Player | Level_A ] -> link A2
right [ Level_A | Level_A | Level_A Player ] -> link A3

right [ Level_B Player | Level_B | Level_B | Level_B ] -> link B1
right [ Level_B | Level_B Player | Level_B | Level_B ] -> link B2
right [ Level_B | Level_B | Level_B Player | Level_B ] -> link B3
right [ Level_B | Level_B | Level_B | Level_B Player ] -> link B4
david-pfx commented 1 month ago

Nice idea. I actually started out going in this direction, but switched tracks to avoid having a rule for each possible level. Having both looks (a) useful and (b) easy.😁