How can I implement a “BeforeCommand” hook in Quest? #1626
-
|
Hi everyone, I want to trigger a check before any player command is processed, so I can modify or override the parser output based on game state. Essentially, I’m looking for something like a global Here are some example scenarios I want to implement:
My question:
Thanks for any guidance! P.S. The question was analysed and rephrased by a bot. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
The function that actually handles commands is In that hack, it's checking if the room or any objects have an ACTION attribute. If something has an ACTION attribute which returns You could use your own conditional checks at every point where I have There might a better approach, but this seems to work, as far as I've tested things. |
Beta Was this translation helpful? Give feedback.
The function that actually handles commands is
ResolveNextName. It's the first modified function in this file: https://github.com/KVonGit/zork1/blob/quest5_port/Quest5_Port/HACKS.aslxIn that hack, it's checking if the room or any objects have an ACTION attribute. If something has an ACTION attribute which returns
true, nothing else will run after that point.You could use your own conditional checks at every point where I have
HANDLED_BY_ACTION = Eval(blahblahblah). (NOTE: I might need to add an extra step when there istextin the command, like ASK BOB ABOUT SO AND SO. I have not tested that at all yet.)There might a better approach, but this seems to work, as far as I've tested things.