Here is a snippet from my tutorial game. I'll polish it up later, but hopefully this will help. You should be able to copy-paste this into a game of yours and see how it works. Actually, I'd open a new game and go to code view. Paste the code after /game and before /asl in code view.
<object name="edible flag room">
<inherit name="editor_room" />
<alias>edible triggering an event room</alias>
<description><![CDATA[In this room, you will see how to eat something which causes an event to occur. Do these steps to see it in action:<br/>1. go to sleep<br/>2. eat the muffin<br/>3. go to sleep<br/>4. wake up]]></description>
<object name="bed">
<inherit name="editor_object" />
<look>It's a bed.</look>
<lie type="script">
if (GetBoolean(muffin, "eaten")) {
msg ("That muffin really did you in! You lie down in bed and quickly fall asleep. (type 'wake up' to wake back up).")
}
else {
msg ("You lie down in bed and toss and turn. You just aren't tired enough to fall asleep.")
}
</lie>
</object>
<object name="muffin">
<inherit name="editor_object" />
<look>It's a muffin made of flour, sugar, eggs, milk, valium, and vanilla.</look>
<eat type="script">
msg ("You scarf down the valium laced muffin. Tasty.")
RemoveObject (muffin)
SetObjectFlagOn (muffin, "eaten")
</eat>
</object>
<object name="Magoo">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="namedmale" />
<attr name="pov_look">You're Magoo. A simple being trapped in a test game.</attr>
<look type="script">
if (game.pov = Xanadu) {
msg ("Holy moly! That looks exactly like you! To take control of Magoo, just type 'switch to Magoo'.")
}
else {
msg ("You are a simple being trapped in a test game.")
}
</look>
</object>
<command name="wake up cmd">
<pattern>wake up</pattern>
<script>
msg ("You wake from sleep after a long nap feeling refreshed. You get out of bed.")
MoveObjectHere (muffin)
</script>
</command>
<command name="go to sleep cmd">
<pattern>go to sleep</pattern>
<script>
if (GetBoolean(muffin, "eaten")) {
msg ("That muffin really did you in! You lie down in bed and quickly fall asleep.")
}
else {
msg ("You lie down in bed and toss and turn. You just aren't tired enough to fall asleep.")
}
</script>
</command>
</object>
I would suggest NOT using the edibles option under the features tab of the object. Just create the verb 'eat' under the verb tab, add eat, and run the scripts you want to run. The built-in edibles options never really worked well for me.
After you 'go to sleep' in this tutorial, it gets a bit sloppy, but it's 3:20am here and I'm tired. If you have questions or need clarification, please ask and I'll respond after I wake up! Good luck!
XanMag