Author Topic: Taking an Inventory Item away from character  (Read 9347 times)

0 Members and 1 Guest are viewing this topic.

Offline gumby

Re: Taking an Inventory Item away from character
« Reply #15 on: August 30, 2011, 04:40:56 PM »
This makes perfect sense - I'll have to give this a shot when I get a chance.  Thanks!
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline MusicallyInspired

Re: Taking an Inventory Item away from character
« Reply #16 on: August 30, 2011, 06:48:11 PM »
Thank you! I'll try this out later tonight and report back. Makes more sense now. Looks like it should work.
Brass Lantern Prop Competition

Offline MusicallyInspired

Re: Taking an Inventory Item away from character
« Reply #17 on: September 01, 2011, 05:48:49 PM »
This works wonderfully! The only problem was that the procedure was called incorrectly. It should instead read:

Code: [Select]
(if (== IsOwnedBy(INV_ITEM gRoomNumber) TRUE)
    ...
)

or for Ego:

Code: [Select]
(if (== IsOwnedBy(INV_ITEM ego) TRUE)
    ...
)

There were also some bracket issues with the actual procedure declaration, but it's simple enough to sort out. Here's the code again for those who just want to copy and paste:

Code: [Select]
(procedure public (IsOwnedBy invItem roomOrActor)
(var checkObject)
= checkObject (send gInv:at(invItem))
(if(IsObject(checkObject))
return (send checkObject:ownedBy(roomOrActor))
)(else
return(0)
)
)

Thank you so much, Lars! Truly invaluable! Now I don't have to make several if cases for what objects ego is carrying! All I have to do is make the script check whether the room owns it or not. I'm sure this will save on memory and size.
Brass Lantern Prop Competition

Offline Collector

Re: Taking an Inventory Item away from character
« Reply #18 on: September 01, 2011, 06:35:28 PM »
Would you mind adding it to the Wiki?
KQII Remake Pic

Offline gumby

Re: Taking an Inventory Item away from character
« Reply #19 on: September 01, 2011, 08:28:28 PM »
Nice!  I'm glad you got it working.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline MusicallyInspired

Re: Taking an Inventory Item away from character
« Reply #20 on: September 01, 2011, 08:38:16 PM »
Sure, I can. Just tell me how lol. I'm logged in. I don't really see where to add a page. Also, what would be the best spot to put it in? Examples?
Brass Lantern Prop Competition

Offline Collector

Re: Taking an Inventory Item away from character
« Reply #21 on: September 02, 2011, 12:30:43 AM »
Just do a search for the title you want to give your page and if there no such page it will give you the opportunity to create it. You can add it to all of the appropriate categories by adding (at the bottom of the page)
Code: [Select]
[[Category:Examples]]
[[Category:Scripting]]
[[Category:Syntax]]
This will add it to the Examples, Scripting and Syntax categories. This page will give you more info on the formatting, etc.

http://sierrahelp.com/SCI/Wiki/index.php?title=Help:Contents

KQII Remake Pic

Offline gumby

Re: Taking an Inventory Item away from character
« Reply #22 on: September 03, 2011, 10:50:18 AM »
This really helps with my understanding of the inventory.  I always conceived it as 'what is the player holding', however it encompasses all 'takeable' objects within a game, whether they are currently in your inventory or not.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline MusicallyInspired

Re: Taking an Inventory Item away from character
« Reply #23 on: September 03, 2011, 01:50:19 PM »
Indeed. We've been surviving thus far on little tricks, hacks, and workarounds when we didn't understand the proper concepts of the template game specifics.
Brass Lantern Prop Competition


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.084 seconds with 24 queries.