Re: The Inventory
Status: Alpha
Brought to you by:
cwalther
|
From: James C. W. <jfc...@ya...> - 2012-01-05 23:59:00
|
Okay, thanks..It looks like taking away the unnesseary arguement
solves it. However, for the future, I'm not aware of what the list index of the
object is, or how to find it. If it's the number that the inventory table
assigns the object, wouldn't that be biased toward the order in which the
player picks up items?
________________________________
From: Christian Walther <cwa...@gm...>
To: pip...@li...
Sent: Tuesday, January 3, 2012 11:55 AM
Subject: Re: The Inventory
James C. Wilson wrote:
> I'm having a bit of trouble applying the
> inventory operations in the demo to my project: Is this the proper way
> to test if an inventory object is carried, then drop it?
> Pipmak doesn't see equality.
>
> hotspot {
> cursor = cur_inventory, enabled = not state.observCablePlaced,
> onmousedown = function()
> if state.inventory[state.inventory.carried] == "TVCable" then
> inventory:message("drop", "TVCable")
> pipmak.gethotspot(3):enable(false)
> state.observCablePlaced = true
> pipmak.getpatch(1):setvisible(true)
> end
> end
> }
One mistake I can see is that the "drop" message of the inventory takes
an index, not an object name. You can also leave out the argument
entirely, it will then automatically assume state.inventory.carried. See
nodes 9 (use of the key from the inventory in a similar way to what
you're trying to do) and 50 (inventory) in the demo project.
If as you say you don't even get that far because
state.inventory[state.inventory.carried] == "TVCable" is never true,
then I would suggest inserting
pipmak.print(state.inventory[state.inventory.carried])
or examining state.inventory using the table inspector from the Lua
command line to find out what it is.
-Christian
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Pipmak-Users mailing list
Pip...@li...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users |