Simple eating / hide object script

OurJud
04 Dec 2015, 04:24What the hell am I doing wrong here?!
I thought I'd start building a collection of some simple scripts that I can just copy and paste whenever I need them.
The first I decided to do was set up a kitchen containing a sandwich. The player eats the sandwich, after which 'L' would describe the room again, minus the sandwich.
One of the things I'm trying to do is make it so that the player doesn't have to type 'take sandwich' first. I've always been irritated by such detail in adventure games - the fact that I have to 'take' before I can 'use'. If you present the player with a sandwich, and they type 'eat sandwich', it's clearly obvious that they want to eat the sandwich, so having the game say, "You're not holding that." I've always found silly.
So anyway. This is my room code:
I have sandwich (with kitchen as parent) set to visible in the 'setup' tab, and 'Can be eaten' in the 'edible' tab
But this is the sequence when I run it:
What am I doing wrong!?
I thought I'd start building a collection of some simple scripts that I can just copy and paste whenever I need them.
The first I decided to do was set up a kitchen containing a sandwich. The player eats the sandwich, after which 'L' would describe the room again, minus the sandwich.
One of the things I'm trying to do is make it so that the player doesn't have to type 'take sandwich' first. I've always been irritated by such detail in adventure games - the fact that I have to 'take' before I can 'use'. If you present the player with a sandwich, and they type 'eat sandwich', it's clearly obvious that they want to eat the sandwich, so having the game say, "You're not holding that." I've always found silly.
So anyway. This is my room code:
msg ("You are in a kitchen. There is a table here, on top of which sits a fresh sandwich.")
if (not ListContains(ScopeVisible(), sandwich)) {
msg ("You are in a kitchen. There is a table here.")
}
I have sandwich (with kitchen as parent) set to visible in the 'setup' tab, and 'Can be eaten' in the 'edible' tab
But this is the sequence when I run it:
You are in a kitchen. There is a table here, on top of which sits a fresh sandwich.
> eat sandwich
Yum yum!
> l
You are in a kitchen. There is a table here, on top of which sits a fresh sandwich.
Error running script: Unknown object or variable 'sandwich'
What am I doing wrong!?
HegemonKhan
04 Dec 2015, 04:38it probably has something to do with the default coding, such as for example: does the 'edible eat', remove~delete the sandwich from the kitchen (is the sandwich still there on the table in the kitchen after you've "eaten" it) ??? Or, maybe it's re-running the room description and "see's but doesn't see" the 'sandwich', hence the error... OR, the sandwich *IS* destroyed~removed, and thus an error with your script of 'if (not (ListContains(ScoreVisible(), sandwich)))' as there is no longer any sandwich, etc etc etc
if it's due to the sandwich being destroyed and your 'not listcontains(sandwich)', you're going to need to use another check for if the sandwich is in (exists in) the kitchen itself or not:
personally, I'd just create your own 'whatever eat' Verb, and not use the 'edible' and 'eat' Verb default built-in coding... but that's just me as I still have trouble with understanding the 'health' and 'edible' default built-in stuff, lol.
if it's due to the sandwich being destroyed and your 'not listcontains(sandwich)', you're going to need to use another check for if the sandwich is in (exists in) the kitchen itself or not:
if (ListContains (GetAllChildObjects(), "sandwich") {
if (not ListContains (ScopeVisible(), "sandwich") {
msg ("You don't immediately see, out in the open, any sandwich in the kitchen... but maybe there's a sandwich in the refridgerator...")
} else {
// your eating sandwich scripts
}
} else {
msg ("There is no sandwich... (maybe you already ate it...)")
}
personally, I'd just create your own 'whatever eat' Verb, and not use the 'edible' and 'eat' Verb default built-in coding... but that's just me as I still have trouble with understanding the 'health' and 'edible' default built-in stuff, lol.

OurJud
04 Dec 2015, 04:52HegemonKhan wrote:
personally, I'd just create your own 'whatever eat' Verb, and not use the 'edible' and 'eat' Verb default built-in coding... but that's just me as I still have trouble with understanding the 'health' and 'edible' default built-in stuff, lol.
This is what I did first time round, HK, although mine was a command. I'll see what happens with verb.
Thanks


OurJud
04 Dec 2015, 05:02Nope, don't know how verb scripts work.
I can't believe this is so difficult.
You're in a kitchen, there's a sandwich.
You eat the sandwich.
You're in a kitchen, there is no sandwich.
Why is that so complex to code, when you have features like 'move object' 'hide object' and 'make object invisible' at your disposal??
I can't believe this is so difficult.
You're in a kitchen, there's a sandwich.
You eat the sandwich.
You're in a kitchen, there is no sandwich.
Why is that so complex to code, when you have features like 'move object' 'hide object' and 'make object invisible' at your disposal??

OurJud
04 Dec 2015, 05:17I had a brew to clear my head, and have almost got it now.
I set up a command for 'eat sandwich', which prints "Yum yum" and then I make the sandwich invisible.
The room code then recognises this and throws out the desired description, and excludes the sandwich.
Only glitch now is that because 'eat sandwich' is set as a command, 'eat sandwich' continues to get the 'Yum yum!' response, even when it's not there.
I tried adding the rule to the command, saying if the sandwich was not visible, print "You already ate it.", but it just prints this along with "Yum yum!"
I set up a command for 'eat sandwich', which prints "Yum yum" and then I make the sandwich invisible.
The room code then recognises this and throws out the desired description, and excludes the sandwich.
Only glitch now is that because 'eat sandwich' is set as a command, 'eat sandwich' continues to get the 'Yum yum!' response, even when it's not there.
I tried adding the rule to the command, saying if the sandwich was not visible, print "You already ate it.", but it just prints this along with "Yum yum!"
HegemonKhan
04 Dec 2015, 05:19it's impossible to program in the infinite situations that exists... instead you program in the ability to handle those infinite situations (which quest does very well for coders and non-coders alike ~ though you got to be patient and learn the software like any game engine software, as well as the logic that is required for achieving what you want to do within your game), but then that still leaves the person (or they get some help with it, wink) having to actually code in (or if able use the GUI~Editor ~ though some stuff you just have to code, the GUI~Editor can't handle everything) for their specific situations, though this is the only way to do it as again you can't program in infinity, there's an infinite amount of things that people want from programming, which is impossible to program, as we're talking about inifinity here.
you should just be able to create~add a Verb, and put in this scripting of yours into it:
--------------
You already know what a nightmare it is to try to program~account for every possible situation in your own game making, well now expand that to creating a game engine... for people to use. If you think it's hard or taxing to have your game handle every action~command~etc a person~user may try, imagine trying to create a game engine, or a programming language itself... I think you understand now. You program in the ability to handle infinity, as best you can, you don't try to program in the infinity itself, lol.
-------------
Neonayon I think came to quest not knowing any (or hardly any) programming, and now, since she stayed with it, is making a quite advanced RPG, and is almost reaching my own level~knowledge of programming. She's going to surpass me soon, laughs.
so, if I can learn to program, and otehrs are able to as well, so can you. but, you got to be patient, it's a slow and hard process, but you will learn. I can say that quest is a far better way to learn the fundamentals of programming (well scripting anyways), then trying to learn from an actual programming language and~or a class on one of them, laughs. As I'm taking programming classes now, and I can empirically say: LEARN TO CODE FROM QUEST, BEFORE YOU TAKE A PROGRAMMING CLASS! I'm am absolutely amazed at how knowledgeable I am with programming compared to most people in my beginning programming classes, quest has prepared me so well! I'm really shocked at how well and how much quest has taught me in the world of programming, hehe
you should just be able to create~add a Verb, and put in this scripting of yours into it:
if (not ListContains (ScopeVisible(), "sandwich") {
msg ("You don't immediately see, out in the open, any sandwich in the kitchen... but maybe there's a sandwich in the refridgerator...")
} else {
msg ("Yum yum")
// make sandwich invisible script(s)
}
--------------
You already know what a nightmare it is to try to program~account for every possible situation in your own game making, well now expand that to creating a game engine... for people to use. If you think it's hard or taxing to have your game handle every action~command~etc a person~user may try, imagine trying to create a game engine, or a programming language itself... I think you understand now. You program in the ability to handle infinity, as best you can, you don't try to program in the infinity itself, lol.
-------------
Neonayon I think came to quest not knowing any (or hardly any) programming, and now, since she stayed with it, is making a quite advanced RPG, and is almost reaching my own level~knowledge of programming. She's going to surpass me soon, laughs.
so, if I can learn to program, and otehrs are able to as well, so can you. but, you got to be patient, it's a slow and hard process, but you will learn. I can say that quest is a far better way to learn the fundamentals of programming (well scripting anyways), then trying to learn from an actual programming language and~or a class on one of them, laughs. As I'm taking programming classes now, and I can empirically say: LEARN TO CODE FROM QUEST, BEFORE YOU TAKE A PROGRAMMING CLASS! I'm am absolutely amazed at how knowledgeable I am with programming compared to most people in my beginning programming classes, quest has prepared me so well! I'm really shocked at how well and how much quest has taught me in the world of programming, hehe


OurJud
04 Dec 2015, 05:30HegemonKhan wrote:You already know what a nightmare it is to try to program~account for every possible situation in your own game making, well now expand that to creating a game engine... for people to use. If you think it's hard or taxing to have your game handle every action~command~etc a person~user may try, imagine trying to create a game engine, or a programming language itself...
But that's my whole point. This isn't difficult! I know I'm just missing something.
To have an object in a room, that doesn't show up in the description after the player has eaten it, is NOT difficult or complex in the slightest.

XanMag
04 Dec 2015, 05:35My advice...
1. Add the verb eat to object sandwich. Do not use the edible tab.
2. For that eat script, simply print message and remove object from game.
---
3. If you want to describe the kitchen with and without the sandwich, give sandwich flag 'eaten' when eaten.
4. Run an 'if' script in the kitchen setup and have a description for 'if' the sandwich has flag eaten, then print message containing kitchen description without the sandwich and 'else' print a message with the sandwich present.
1. Add the verb eat to object sandwich. Do not use the edible tab.
2. For that eat script, simply print message and remove object from game.
---
3. If you want to describe the kitchen with and without the sandwich, give sandwich flag 'eaten' when eaten.
4. Run an 'if' script in the kitchen setup and have a description for 'if' the sandwich has flag eaten, then print message containing kitchen description without the sandwich and 'else' print a message with the sandwich present.
HegemonKhan
04 Dec 2015, 05:36and it 95% of the time is something very stupid and simple, laughs. I'm just failing to help you with it. Wait for the better people, and they'll get this fixed up quick for you. My own failure at helping you is all me, laughs. Just wait for someone else to help you, it'll be something simple and stupid, as it almost always is, you often are actually doing the right thing, and it's just some stupid and small thing holding you up, laughs.
HegemonKhan
04 Dec 2015, 05:38@ XanMag:
if you destroy the sandwich, then you destroy its 'eaten' Boolean Attribute too, and thus your 'if' checking script will produce an error.
if you just move the sandwich (to another room), then there won't be an error; it'll work fine~well.
if you destroy the sandwich, then you destroy its 'eaten' Boolean Attribute too, and thus your 'if' checking script will produce an error.
if you just move the sandwich (to another room), then there won't be an error; it'll work fine~well.

OurJud
04 Dec 2015, 05:42I got there! You're right HK, it usually is something very stupid and simple, namely me.
Xan, I thought about flags and was busy doing it when you made your post.
Anyway, for those interested, here's the solution:
Room script:
And the 'eat sandwich' command script:
Xan, I thought about flags and was busy doing it when you made your post.
Anyway, for those interested, here's the solution:
Room script:
if (ListContains(ScopeVisible(), sandwich)) {
msg ("You are in a kitchen. There is a table here, on top of which sits a fresh sandwich.")
}
if (not ListContains(ScopeVisible(), sandwich)) {
msg ("You are in a kitchen. There is a table here.")
}
And the 'eat sandwich' command script:
firsttime {
msg ("Yum yum!")
SetObjectFlagOn (player, "eaten")
MakeObjectInvisible (sandwich)
}
otherwise {
if (GetBoolean(player, "eaten")) {
msg ("You already ate it.")
}
}
HegemonKhan
04 Dec 2015, 05:46bravo!, small steps, small steps, and when you look back, you'll find that you've traveled so far from where you began, laughs 
you got to be patient and determined... not an easy thing... I know...
(what I hate most... My brain will explode~migrain from working~thinking so hard, in trying to and failing to, write a program for like 3 days, and then the next day, after a good long sleep, I'm able to get it written~working with hardly any effect~thinking at all... GRR!!!!)

you got to be patient and determined... not an easy thing... I know...
(what I hate most... My brain will explode~migrain from working~thinking so hard, in trying to and failing to, write a program for like 3 days, and then the next day, after a good long sleep, I'm able to get it written~working with hardly any effect~thinking at all... GRR!!!!)

OurJud
04 Dec 2015, 05:54I know what you mean. The plan was to get a good few 'frequently used' scripts written, so I could just drop them in when required, but in the end I only got a measly one written.
Ah well, Red Dwarf time. That'll cheer me up!
Ah well, Red Dwarf time. That'll cheer me up!
The Pixie
04 Dec 2015, 08:08OurJud wrote:I got there! You're right HK, it usually is something very stupid and simple, namely me.
Xan, I thought about flags and was busy doing it when you made your post.
Anyway, for those interested, here's the solution:
Room script:if (ListContains(ScopeVisible(), sandwich)) {
msg ("You are in a kitchen. There is a table here, on top of which sits a fresh sandwich.")
}
if (not ListContains(ScopeVisible(), sandwich)) {
msg ("You are in a kitchen. There is a table here.")
}
And the 'eat sandwich' command script:firsttime {
msg ("Yum yum!")
SetObjectFlagOn (player, "eaten")
MakeObjectInvisible (sandwich)
}
otherwise {
if (GetBoolean(player, "eaten")) {
msg ("You already ate it.")
}
}
It works, so perhaps that is good enough, but for future reference:
I would set up a room for things that are not currently in the game. I call in "nowhere" in my games, other people have other names like "offstage". Move the sandwich there when it is eaten. However, if you want to do it with flags:
Room script, use else instead of checking the condition is not true:
if (ListContains(ScopeVisible(), sandwich)) {
msg ("You are in a kitchen. There is a table here, on top of which sits a fresh sandwich.")
}
else {
msg ("You are in a kitchen. There is a table here.")
}
And the 'eat sandwich' command script, you can use the "visible" flag as you are already setting that (and should flag the sandwich, not the player; you might have half a dozen items that can be eaten):
firsttime {
msg ("Yum yum!")
MakeObjectInvisible (sandwich)
}
otherwise {
if (not GetBoolean(sandwich, "visible")) {
msg ("You already ate it.")
}
}
In theory the otherwise should never happen...

OurJud
04 Dec 2015, 09:33The Pixie wrote:
I would set up a room for things that are not currently in the game. I call in "nowhere" in my games, other people have other names like "offstage". Move the sandwich there when it is eaten.
I did this very early on, but was still getting the 'Error running script: Unknown object or variable 'sandwich''. I called the room 'trash' and moved it there in the command script. I must've have been messing the rule up somewhere else, but couldn't get it to work by moving the sandwich.
The Pixie
04 Dec 2015, 11:22If you are getting that error it must be because the sandwich no longer exists at all; you must have been destroying it instead of or as well as moving it.

OurJud
04 Dec 2015, 12:16The Pixie wrote:If you are getting that error it must be because the sandwich no longer exists at all; you must have been destroying it instead of or as well as moving it.
Are you saying I had a rogue 'make invisible' rule somewhere?
The Pixie
04 Dec 2015, 13:02A rogue 'destroy' rule. If it was invisible, it would still exist, and you would not get that error. If you use the built in "edible" type, that does a destroy, which would cause your error.
In fact, the edible thing is not that well done, in my opinion. If you are using health, then it will add to the player's health, but you have to look hard to discover you need to set the "eatheath" attribute to do that - why is that not on the tab? And if you are not using health, it is completely useless because you cannot change anything in the game world and you cannot check the state of the food, as it might not even exist now.
In fact, the edible thing is not that well done, in my opinion. If you are using health, then it will add to the player's health, but you have to look hard to discover you need to set the "eatheath" attribute to do that - why is that not on the tab? And if you are not using health, it is completely useless because you cannot change anything in the game world and you cannot check the state of the food, as it might not even exist now.

XanMag
04 Dec 2015, 13:18Here is a snippet from a tutorial game that I have been working on. Wow... I'm up to 28 distinct rooms now that can be used as a template. =) That is use as a template in XanMag's own 'special, backward, no code experience' kind of way. Anyway, here is the code from a room I called 'edible flag room'. Not sure if it would be helpful or not, but here you go.
I use flags in this room to change descriptions and trigger things to happen. If you eat the cantaloupe, a flag 'eaten' goes on cantaloupe and the cantaloupe is removed at that point. If you look at the room description again, there is no mention of a cantaloupe because it has been eaten. Removing an item does not also remove a flag. In fact, with the muffin, I eat the muffin, remove the muffin, go to sleep, wake up, move muffin to current room, and voila! a new muffin appears.
<object name="edible flag room">
<inherit name="editor_room" />
<alias>edible triggering an event room</alias>
<description type="script"><![CDATA[
if (GetBoolean(cantaloupe, "eaten")) {
msg ("<br/>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<br/><br/>See! The cantaloupe does not have a description here. Once you type 'eat cantaloupe' you can put up a flag. I named mine 'eaten'. Then, I put an if script in this room's description that did not include information about the cantaloupe.")
}
else {
msg ("<br/>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<br/><br/>There is a fresh cantaloupe here as well.<br/><br/>Also, to alter room description after eating ssomething, eat the cantaloupe and have a look around.")
}
]]></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>
<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>
<exit alias="south" to="different kind of objects room">
<inherit name="southdirection" />
</exit>
<object name="cantaloupe">
<inherit name="editor_object" />
<look>It is a cantaloupe shaped like your head. Eat it.</look>
<eat type="script">
msg ("You devour the head-shaped cantaloupe.")
SetObjectFlagOn (cantaloupe, "eaten")
RemoveObject (cantaloupe)
</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>
</object>
I use flags in this room to change descriptions and trigger things to happen. If you eat the cantaloupe, a flag 'eaten' goes on cantaloupe and the cantaloupe is removed at that point. If you look at the room description again, there is no mention of a cantaloupe because it has been eaten. Removing an item does not also remove a flag. In fact, with the muffin, I eat the muffin, remove the muffin, go to sleep, wake up, move muffin to current room, and voila! a new muffin appears.

OurJud
04 Dec 2015, 13:34The Pixie wrote:If you use the built in "edible" type, that does a destroy, which would cause your error.
Ah! That is a distinct possibility, as I resorted to it when I couldn't get it to work with a command script.
Xan, that's some complex scripting for someone who claims they're don't know what they're doing.

XanMag
04 Dec 2015, 13:55Haha. I totally have no clue about traditional coding. Without the GUI, I would accomplish nothing. I have a very difficult time understanding forums when the code gurus start talking in code. =)
1. Add object.
2. Add verb eat.
3. In that 'eat script' add flag 'eaten' to cantaloupe. Can be found under Variables.
4. Add 'Remove object cantaloupe' script to your eat verb.
5. In room description, 'Run Script', 'If', 'if object cantaloupe has flag eaten' then 'print message' without cantaloupe in the description, 'Else' 'print message' with cantaloupe in room description.
1. Add object.
2. Add verb eat.
3. In that 'eat script' add flag 'eaten' to cantaloupe. Can be found under Variables.
4. Add 'Remove object cantaloupe' script to your eat verb.
5. In room description, 'Run Script', 'If', 'if object cantaloupe has flag eaten' then 'print message' without cantaloupe in the description, 'Else' 'print message' with cantaloupe in room description.

OurJud
04 Dec 2015, 14:13XanMag wrote:
1. Add object.
2. Add verb eat.
3. In that 'eat script' add flag 'eaten' to cantaloupe. Can be found under Variables.
4. Add 'Remove object cantaloupe' script to your eat verb.
5. In room description, 'Run Script', 'If', 'if object cantaloupe has flag eaten' then 'print message' without cantaloupe in the description, 'Else' 'print message' with cantaloupe in room description.
Well that's what I successfully did eventually, and yet your script is about four times as long as mine.
Must confess I don't know the difference between commands and verbs. In fact, I don't know what to do with verbs, as I don't understand the interface on verbs like I do the one on commands.
The Pixie
04 Dec 2015, 14:27This might help.
http://docs.textadventures.co.uk/quest/ ... verbs.html
http://docs.textadventures.co.uk/quest/ ... verbs.html

XanMag
04 Dec 2015, 14:40Well... That is a bit of code from a tutorial game. It includes the stuff about the player (Magoo) that the player needs in a separate tutorial room. The eventual purpose of the tutorial is that the player can download the .aslx file and "Play" the game from there. That way they can see it in game and see it in the GUI at the same time.
As for verbs and commands... I use commands for the odd things that a player may type that isn't as cut and dry as "use ____ on ____" or "eat" or "open ____" or "read", etc.
I frequently use commands for two reasons...
One, to try and accommodate the different kinds of things a player may type in that aren't really obvious - I dropped the ball on the 'focus on' intro to my game!
(but it has been fixed). I tend to use them a lot for alternatives to use on/put in. Example - removing a mask - remove mask; take off mask; remove surgical mask; take off surgical mask or - use on/put in - put axle in box; use axle in box; place axle in box; use axle in box; use axle on box
Two, universal game responses, like when a player swears, types 'kill me'.
I use verbs for 'normal', or more one-dimensional text adventure uses like 'eat', 'move', 'push', 'talk to', 'smell', 'touch', 'push', etc.
As for verbs and commands... I use commands for the odd things that a player may type that isn't as cut and dry as "use ____ on ____" or "eat" or "open ____" or "read", etc.
I frequently use commands for two reasons...
One, to try and accommodate the different kinds of things a player may type in that aren't really obvious - I dropped the ball on the 'focus on' intro to my game!

Two, universal game responses, like when a player swears, types 'kill me'.
I use verbs for 'normal', or more one-dimensional text adventure uses like 'eat', 'move', 'push', 'talk to', 'smell', 'touch', 'push', etc.

OurJud
04 Dec 2015, 15:20The Pixie wrote:This might help.
http://docs.textadventures.co.uk/quest/ ... verbs.html
Bookmarked.
HegemonKhan
04 Dec 2015, 15:47Pixie has been making quite a few guides~Libraries since you've been gone OJ, hehe 


Anonynn
04 Dec 2015, 16:49What I did in this situation was...
1. Make the kitchen table a surface container, and make a first time script involving the sandwich.
2. The sandwich won't be listed in the description, but if the player looks at the table specifically the sandwich will appear. Then allow them to take the sandwich and if they happen to look again, the first time script will simply say something like, "you see a empty table" or something along those lines. An if script should work too.
3. Make a script that when the player enters the room, the sandwich appears in the surface container.
Hope that helps!
1. Make the kitchen table a surface container, and make a first time script involving the sandwich.
2. The sandwich won't be listed in the description, but if the player looks at the table specifically the sandwich will appear. Then allow them to take the sandwich and if they happen to look again, the first time script will simply say something like, "you see a empty table" or something along those lines. An if script should work too.

3. Make a script that when the player enters the room, the sandwich appears in the surface container.
Hope that helps!
Marzipan
05 Dec 2015, 20:33Haven't been here in quite awhile, so glad to see you're getting back and working on your projects too OurJud. 
I'm actually doing something similar right now, compiling a collection of code snippets for a variety of scenarios in the hopes of tackling and actually completing a planned project in January. (Didn't do NaNo this year, so January will be my personal one. Far more free time and I can tie it in with my New Year's resolution.)
I hope you realize of course that no seasoned adventurer will ever eat your sandwich. They'll just carry it around in their inventory for the entire game in case it's needed to solve a puzzle.

I'm actually doing something similar right now, compiling a collection of code snippets for a variety of scenarios in the hopes of tackling and actually completing a planned project in January. (Didn't do NaNo this year, so January will be my personal one. Far more free time and I can tie it in with my New Year's resolution.)
I hope you realize of course that no seasoned adventurer will ever eat your sandwich. They'll just carry it around in their inventory for the entire game in case it's needed to solve a puzzle.


OurJud
06 Dec 2015, 05:44Marzipan wrote:
I hope you realize of course that no seasoned adventurer will ever eat your sandwich. They'll just carry it around in their inventory for the entire game in case it's needed to solve a puzzle.
Yes, I did consider that. I could always starve them to death for not eating it when they had the chance

Good to see you, too, Marz. All we need is Jay and Silver to get their arses back here now.