This assumes you are using a COB Compiler and a tool for creating COS files. Both of these are available for download from the CDN.
You now know what an object is, but to turn that into a COB that everyone can add to (and equally importantly, remove from) their world needs a few special considerations.
The COB itself will usually be comprised of 3 distict parts: an insertion or creation chunk, an event chunk and a removal chunk. The insertion chunk is the part of your code that gets run when the 'add' button is pressed on the Creatures 2 Agent Injector - and this usually creates your object(s) and sets up them up ready for operation. The event chunk contains all the event scripts you will have written for your object(s) and will also be added to the world when 'add' is pressed. The removal chunk contains the code you need to remove all presence of everything you have added, so it will usually kill all objects you have created and also remove their scripts from the world. The removal chunk only gets operated on when the 'remove' button is pressed on the Agent Injector.
These descriptions detail the general usage of these three chunks, but it is important to realise that the only difference between an insertion and removal chunk is the fact they are linked to certain buttons and are expected to perform a certain way. It is totally possible to create an insertion chunk that removes objects, and a removal chunk that adds objects. Sometimes this ability is useful and one example that springs to mind is when you create an object with the intention of there being only a certain number of them - you can create an insertion chunk that actually removes all existing ones before adding your new ones.
You can create COS files using the CyberLife CAOS Tool that will allow you to mark out the 3 types of chunk and inject each part independently of the others - in this way you can build up a removal chunk at the same time as creating and it makes it easier to remove any mistakes you make while developing.
The 3 chunks are illustrated in the example below, notice the use of an asteriks (*) for marking comments - these lines are ignored by CAOS tools:
****this is the insertion chunk****
new: simp bal2 8 0 9000 0
setv cls2 2 1 10000
setv attr 192
****this is the event chunk****
scrp 2 1 10000 4
scrp 2 1 10000 5
****this is the removal chunk****
enum 2 1 10000
scrx 2 1 10000 4
scrx 2 1 10000 5
The important commands here are iscr and rscr which mark the insertion and removal chunks respectively. The event chunk is marked by the presence of the scrp command.
By default a COS file's content is assumed to be an insertion, in this way you can ignore the iscr tag most of the time and inject small CAOS fragments without having to specify it as an insertion. It is useful to think of the 3 chunks as being controlled by 3 radio buttons, which by default has the iscr button down - then whenever you click on another button that one goes down and the others come up (where 'clicking the button' is actually including one of the tags or scrp). This is a useful analogy for the modal nature of a COS file within the CAOS Tool environment.
The COB Compiler has a selection of fields that control aspects of the objects usage: Expiry date, delay and number of items. The expiry date can be used if you require the object to be date sensitive, for example, only usable before New Year. The delay can be used to stop the user abusing an object you have created - for example, you might make an object that will inject a creature with the equivalent of an Elixier of Life ... but don't want it over used because then there is no challenge to keeping your creatures alive. Using the delay you can force a time span between injections. The number of items field allows you to only supply a fixed number of objects before the COB expires. This number of items field should not be confused with the number of actual in-game items that appear - you can create code that would inject 50 carrots, for example, for every press of the 'add' button. The number of items field is purely concerned with the number of times that the 'add' button can be pressed.