Good evening,
MakeObjectsInvisible (EverythingInInventory)
Any thoughts on the matter?
This doesn't sound very realistic to me, but I don't really know the context.
My line of thinking:
I pick up a stick.
I pick up a backpack.
I drop my backpack.
My stick is gone?
Now, if I actually PUT things in the backpack, that would make sense.
...or if it said, "you pick it up and put it in your backpack," each time I took something, that might not upset me during play. But, if this message was printing, that would mean the TAKE script had to be modified, so it would make more sense to actually move the object into the backpack. Then, when you drop the backpack, that stuff is in the backpack, not in inventory. Problem solved.
So, the way Quest already has containers set up makes more sense to me, but, again, I don't know the context.
Thanks K.V. I'll try it out!
If it works, which I'm sure it will, you just saved me a whole lot of unnecessary work!
(edit: small typo)
You could change the changedparent
script on the defaultobject
type so that picking up an object automatically puts it in the backpack. Then when you drop the backpack you won't be able to use them; but you will be able to open it and take one item with you.
Here's an example off the top of my head:
<changedparent type="script">
if (game.pov = this) {
if (IsDefined("oldvalue")) {
OnEnterRoom(oldvalue)
}
else {
OnEnterRoom(null)
}
if (game.gridmap) {
MergePOVCoordinates
}
}
else if (this.parent = game.pov) {
if (not this = backpack) {
if (backpack.parent = this.parent) {
this.parent = backpack
}
else if (ListCount(ScopeInventory()) > 2) {
msg ("You need a backpack if you want to carry more than two items")
this.parent = oldvalue
}
}
}
this.hasbeenmoved = true
</changedparent>
Or a slightly sillier version:
<changedparent type="script">
if (game.pov = this) {
if (IsDefined("oldvalue")) {
OnEnterRoom(oldvalue)
}
else {
OnEnterRoom(null)
}
if (game.gridmap) {
MergePOVCoordinates
}
}
else if (this.parent = game.pov) {
if (not this = backpack) {
if (backpack.parent = this.parent) {
items_in_hands = FilterByNotAttribute(ListExclude(GetDirectChildren(game.pov), backpack), "visible", false)
if (ListCount(items_in_hands) > 2) {
if (backpack.parent = game.pov) {
picked_item = PickOneObject (items_in_hands)
msg ("Your hands are full, so you put "+GetDisplayName(picked_item)+" in "+GetDisplayName(backpack)+".")
picked_item.parent = backpack
}
else {
msg ("Your hands are full. You probably need "+GetDisplayName(backpack)+".")
}
}
}
}
}
this.hasbeenmoved = true
</changedparent>
If the backpack is either open or transparent, you can use items inside it as if they were in your inventory; and then when you put it down, you can use them as if they were in the room.
The latter version gives the player a little more control. They can put as many items as they want in their backpack, and hold 2 in their hands; and automatically put one at random into the backpack if you type "get" when their hands are full.
That's pretty much exactly what I was going for. I see now (when reading your code) that I woldn't have figured it out myself.
Thanks a lot Mrangel!!