i want to make the player able to be knocked out and be unable to use any verb other than wait
>sleep
You close your eyes to rest.
>take object
You are unconscious!
I would suggest creating a command called "unconscious", which has the regular expression pattern ^(?!wait\b)
and displays a message saying something like "you can't do that".
When the player is unconscious, there are two options:
Enable the "unconscious" command (which runs for any command other than "wait") by moving it into the player's room. (MoveObjectHere (unconscious)
)
AddToInventory (unconscious)
to disable that command again (adding a command to the inventory is the simplest way to remove it; using RemoveObject
would make it work everywhere)Have a room whose description is something appropriate, and move the player there when they are unconscious.
Building off the idea of moving the player:
You could create a character with preset attributes that mimic unconsciousness, name it unconscious_player or something, put it in a room that describes being unconscious, and have a built-in timerscript/turnscript for that room that calls some function maybe named playerWakeUp() function after some time.
When the player goes unconscious, have some function maybe named PlayerGoUnconscious() change the game.pov = unconscious_player and then display the room's description (maybe use OnEnterRoom() ). When the turnscript finishes have it change game.pov = player and describe the player waking up.