I posted a code below that is similar to something that I did in another game. Ignore all of the other stuff that is in there. It was for other tests!
<object name="A">
<inherit name="editor_room" />
<description type="string"></description>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<enter type="script">
if (RandomChance(50)) {
MoveObjectHere (Ned)
if (ListContains(ScopeVisible(), Ned)) {
msg ("You are in Room A with Ned.")
}
else {
msg ("You are in Room A by yourself.")
}
}
</enter>
<onexit type="script">
MoveObject (Ned, Dead Room)
</onexit>
<exit alias="north" to="D">
<inherit name="northdirection" />
</exit>
<exit alias="south" to="B">
<inherit name="southdirection" />
</exit>
<object name="backpack">
<inherit name="editor_object" />
<inherit name="container_open" />
<look>It is a backpack.</look>
<alt type="stringlist">
<value>pack</value>
<value>bag</value>
</alt>
<take />
<feature_container />
<listchildren />
</object>
<object name="apple">
<inherit name="editor_object" />
<look>It's a red apple.</look>
<take />
</object>
<object name="HKs head">
<inherit name="editor_object" />
<alias>HK's head</alias>
<look>It is the ugliest thing you have every seen. lol</look>
<take />
</object>
<object name="bed">
<lie type="script">
msg ("You climb into bed.")
MoveObject (Fred, bed)
</lie>
<geton type="script">
msg ("You climb into bed.")
MoveObject (Fred, bed)
</geton>
<look>It's a bed.</look>
<description>You are lying in a bed in room A.</description>
<command name="bed dir cmd">
<pattern>n;s;e;w;ne;nw;sw;se;u;d</pattern>
<script>
msg ("Shouldn't you get out of bed first?")
</script>
</command>
<command name="exit bed ccmd">
<pattern>get up;get out of bed;get off bed</pattern>
<script>
msg ("You crawl out of bed.")
MoveObject (Fred, A)
</script>
</command>
</object>
<verb>
<property>geton</property>
<pattern>get on</pattern>
<defaultexpression>"You can't get on " + object.article + "."</defaultexpression>
</verb>
<object name="banana">
<inherit name="editor_object" />
<look>It's a yellow banana.</look>
<take />
</object>
</object>
What I did was that I added an object called bed. In the GUI editor there is an option to change it to a room/object, which I did. Under the object tab, I gave it a description as I would if I looked at it from the bedroom (room A). Under the room tab, I simply put down the description of the room as if I were lying on the bed.
To get into bed, I added a verb to the bed - "lie down on" (etc) and a "get on" verb. In the script for each, I put 'move player 'Fred'' to bed. I added a command to the 'bed' room object/room and typed the following under the 'command pattern' box: w;e;s;n;ne;nw;se;sw;u;d
I added a script that printed this message "Shouldn't you get out of bed first?" You could add a command and replace the cardinal directions with "sleep" and a script for whatever you want to happen.
I added another command to the 'bed' object/room and typed the following under the 'command pattern' box: get out of off;get off bed;stand up (or whatever other cmd you think is appropriate) and then added a script to 'move player Fred' to room A.