Change exit using pulpscript

Is there a way to use pulpscript to change which room an exit leads to? I tried using goto inside a room's exit handler, and when I moved the player through an edge exit set to "nowhere" I got "Fatal: Using goto inside an exit event handler creates an interminal loop" in the browser console.

I would like to just set the exit destinations of the room in the enter handler, but I couldn't find anything in the docs about modifying exits. Should I just implement the exits manually by checking player position on update?

As a workaround still using an exit you could create a new empty room called something like room name exit and have the exit lead into that room. Then put your changing destination logic inside that room's on enter event handler. The player will spend 1 frame I think inside that room, which is the downside compared to a completely manual exit alternative.

1 Like

As I thought through my game idea further, I decided it made sense to handle exits manually. In my game script I have an "on enter" which calculates the exit rooms in each direction and stores them in variables. In my player script I have an "on update" which checks if the player is on the edge of the screen and sends it to the proper location in the corresponding room. The code for this is pretty small.