``` unit Q2; interface uses Classes, SysUtils; procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); implementation procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs); var I: Integer; AItem: TUserItem; begin for I := 0 to Player.CustomItemCount - 1 do //循环取每个物品放置位置上的物品,Player.CustomItemCount表示当前自定义UI上可放置物品的格子总数 begin AItem := Player.CustomItem[I]; if AItem <> nil then //如果物品不为空(即这个位置放入了物品) begin //做些事情! end; end; end; end. ```