Hi,
I guess you have to use the module callbacks that are built for these cases. If you define and register the slot callback function it should be called when you click/drop on a slot.

Code:
// bags
#define MAIN_BAG_ID        1
#define TRADER01_BAG_ID    2
// slots
#define WEAPON_SLOT_ID     1
// groups
#define WEAPON_GROUP       1
// items
#define SWORD01_ID         101
#define SWORD02_ID         102
#define HAMMER01_ID        201
#define HAMMER02_ID        202


function fncMyCallback ( int action, int bag_id, int slot_id, int placed_item_id, int removed_item_id )
{
	if ( bag_id == MAIN_BAG_ID )
	{
		if ( slot_id == WEAPON_SLOT_ID )
		{
			if ( removed_item_id != 0 )
			{
				// Remove the old weapon model
			}
			
			if ( ( placed_item >= SWORD01_ID ) && ( placed_item < HAMMER01_ID ) )
			{
				// Create the new sword model
			}
		}
	}
}

function main ()
{
	Bag *bag = inv_create_bag ( MAIN_BAG_ID, "leather_seam.pcx" );
	Slot *slot = inv_add_slot_to_bag ( bag, WEAPON_SLOT_ID, WEAPON_GROUP, "leather_texture.pcx", 9, 60 ); // Active Weapon slot
	Item *item_sword01 = inv_create_item ( SWORD01_ID, WEAPON_GROUP, "steel_sword.pcx", "steel_sword.pcx" );
	
	set_on_click_callback ( "fncMyCallback" );
}