QuestJS icon indicating copy to clipboard operation
QuestJS copied to clipboard

beforeFirstEnter(), afterFirstEnter() functions not firing for the room you start the game in?

Open Woodhouse3D opened this issue 1 year ago • 3 comments

I've noticed that beforeFirstEnter(), afterFirstEnter() won't fire on the starting room even though beforeEnter() and afterEnter() will.

Further, I think we could put in the docs a tutorial on how to start games. Most text adventures have a preamble of sorts. Could be useful for teaching how to hide certain info and do setup.

Woodhouse3D avatar Jan 07 '25 18:01 Woodhouse3D

I can't find the script that runs when the game starts, but I bet it only calls ~~beforeEnter() and~~ afterEnter(). Should be easy to add the before bits.

...and it seems like there was an easy way to do an intro described in the wiki...

I've been working with old Quest code for a few days... Lemme drink some caffeine and sugar, get my brain working, and I'll be back (if Pixie doesn't beat me to it).

KVonGit avatar Jan 07 '25 19:01 KVonGit

I noticed precisely this same issue. I used this function to create an intro to my old game, but it's not working here. I worked around this by using {once:"..."} in the room description to kind of mimic some intro text, but that won't do much if you want to trigger something to happen at that point. I'm just starting to learn Java (coming from Quest 5's language) so I'm afraid I don't have any further insight than that, but this might help those who just want to add some intro text.

GhostOfMoria avatar Jun 26 '25 18:06 GhostOfMoria

Hello, everyone,

Sorry, I got distracted, for... about five months and forgot to look into this. 😇

If you want an intro when the game begins, you can add something like this to your settings.js file:

settings.setup = function() { alert('Welcome, Adventurer!'); }

KVonGit avatar Jun 27 '25 02:06 KVonGit