How to Hide Scenery Object in Container in Inventory Pane
Dcoder
04 Feb 2017, 15:35I have a chest (container) that always contains a false bottom (scenery object, can't be taken, can't be dropped, and has no alias). The false bottom is there so that the player can interact with it when the chest is open, but can't "see" it.
When the chest is open, the false bottom does NOT show up in the room description, or when you "look at chest", or when the player carries the chest and types "inventory" (as it should be). It also does NOT display in the Places and Objects Pane on the right side (this is also good). However, it DOES show up in the Inventory Pane when the player carries the chest and the chest is open (this is bad!). Any way to completely hide this?
Thanks.
The Pixie
04 Feb 2017, 16:42A bit of a play suggests no, there is not. I thought you could override ScopeInventory
, so it will only return non-scenery items (using RemoveSceneryObjects
), but if you do that, you cannot interact with it at all.

crystalwizard
04 Feb 2017, 16:56What, exactly, are you trying to accomplish here with this false bottom? Stuff that seems logical from a real world perspective frequently has to be accomplished some other way in code. So, explain, please, so we can help you find a good solution.
Dcoder
04 Feb 2017, 17:14I wanted the player to be able to try and remove it, or break it, or something to expose what's underneath. Maybe I'll just get rid of the false bottom object and let the player interact with the chest object instead.

crystalwizard
04 Feb 2017, 17:19no, don't do that. But don't use a scenery object, either. Add a script to the chest that will check for player actions.
Fake code example:
if player (action=hit) chest msg("something seems to rattle under the bottom")
if player (action=pry) chest msg("you pry up the bottom")
.....then if player (action=look in chest) msg("you see diamonds in what was the false bottom")
else msg("I don't understand what you want to do to the chest. You can hit, shake, pry, the chest")
and yeah, you do have to tell them what actions they can take, or you have to accept the fact that your players might just not ever come up with the words you used for success actions.
you can modify that to include a check to see if they have a pry bar in inventory, and if not, then they lack something to pry the bottom up with. And if your player has a strength stat, you can require their strength be over a certain number. You can get very detailed with that.
Remember, just because in the real world you'd need a false bottom, in the game you don't. Your chest doesn't need to have anything in it at all until it's looked in, in fact.
What you really have, in terms of the actual game, is a chest object and a list of objects that chest contains. You also have a state on the chest - opened or closed. If closed, and the player looks in chest, the game just refuses to show them the list of objects, and instead tells them that the chest is closed. If the state is changed to opened, and the player looks in chest, then the game tells them the list of objects.
So that also applies to a "false bottom". There isn't really one there. There's just a state check. If player does some success action -> shake, hit, pry, whatever -> the game displays the appropriate message and checks to see if success is yes or no. If it's yes, it adds whatever was under the false bottom to the list of objects it'll display once the player looks into the open chest.
Stop thinking in terms of what you'd find in the real world, and start thinking in terms of what you want to have happen in reaction to events in the game.
Dcoder
05 Feb 2017, 02:44Thanks, I'll see what I can come up with.
The Pixie
05 Feb 2017, 09:36It is a little hacky, but you can do it. You need to override a couple of functions so this willonly work for the off-line editor.
ScopeInventory
The last line is this:
return (result)
Replace that with:
if (game.incommand) {
game.incommand = false
return (result)
}
else {
return (RemoveSceneryObjects(result))
}
HandleSingleCommand
The last three lines are this:
else {
varlist = Populate(thiscommand.pattern, command, thiscommand.name)
HandleSingleCommandPattern (command, thiscommand, varlist)
}
Replace with this:
else {
varlist = Populate(thiscommand.pattern, command, thiscommand.name)
game.incommand = true
HandleSingleCommandPattern (command, thiscommand, varlist)
}
Dcoder
05 Feb 2017, 15:51Pixie,
In the offline editor, I created a brand new TA game and overrode the 2 default functions by replacing the specified lines with the new code. When I play the game, I get a whole slew of errors! I'm not sure if I did this the way you intended me to.
Don't sweat this though, because I simplified things by deleting the false bottom object and am just applying commands to the chest object. Am curious to understand what you were going for though? Thanks.

crystalwizard
05 Feb 2017, 15:56I wouldn't apply them globally, just to the specific container. I can think of lots of problems that can happen if it's global. Not good.