Interesting.

I put your top code into the inventory.c program.

I tried using the logic of your second code in my OrcStronghold.c program. Here is what I have in OrcStronghold.c :

Code:
...

action dropObject ()
{
	// Code to place weapon on ground next to player, when it is dropped.
}

...

function item_was_dropped ()
{
	Bag *bagPanel;
	if ( !mouse_panel ) // Is the mouse pointer out of a panel?
	{
		if ( inv_is_floating() ) // Does a floating icon exists?
		{
			if ( mouse_left ) // Is the mouse left button pressed?
			{
				var item_id = inv_get_floating_icon_item_id (); // Get the floating icon item id.
				inv_clear_floating_icon (); // Clear the floating icon.
				switch ( item_id ) // Create the new scenery object.
				{
					case SWORD: 
						ENTITY *entObject = ent_create ( "sword.mdl", player.x, dropObject );
						entObject.skill_id = item_id;
						break;
					case MACE: 
						ENTITY *entObject = ent_create ( "mace.mdl", player.x, dropObject );
						entObject.skill_id = item_id;
						break;
				}
			}
		}
	}
}



The code still does not work when I click on an inventory icon saved in the inventory bag, drag it outside the inventory bag, and click that same item icon outside the inventory bag. The inventory icon does not disappear.

I wonder, am I still clicking on some hidden panel when trying to drop an item from my inventory bag?

Last edited by Ruben; 02/12/14 09:26.