The $cid generating routine is used throughout mIRC to assign ids to windows, connections, and other events. The $cid value will increment with each request, so it will depend on the order in which the above resources are created.