Thanks txesmi.

I tried your idea. This is what I created:

Code:
function item_was_dropped ()
{
	Bag *bagPanel;
	
	
	snd_play ( sndDebugger, 100, 0 );
	
	if ( !mouse_panel ) // Is the mouse pointer out of a panel?
	{
		snd_play ( sndDebugger, 100, 0 );
		
		if ( inv_is_floating() ) // Does a floating icon exists?
		{
			snd_play ( sndDebugger, 100, 0 );
			
			if ( mouse_left ) // Is the mouse left button pressed?
			{
				snd_play ( sndDebugger, 100, 0 );
				
				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;
				}
			}
		}
	}
}



When I move an inventory icon from one slot of the inventory bag into a different slot, I hear the DEBUGGER sound, which is an explosion. If I click/drag an inventory icon from being saved in the inventory bag, to a location outside the bag, and left-click, I am not hearing the debugger exploding sound, and nothing happens. So, for some reason, "!mousepanel" does not seem to be registering the clicking outside the inventory bag.