COB Tutorial Lesson 2: A remover script This lesson: Making an object to remove another object. This kind of thing has been done many different ways, but there is only one good way to do it. Here it is. Step 1: What to Delete Let's say I want to create a remover for the cheese object I made in Lesson 1. That object is class 2 6 65, with only one script: 2 6 65 1. Well, that's easy enough. So let's build the remover. Step 2: Creating the Script All right, now open CobCom. In the Object Name box, type "Cheese Variant Remover". Now, click on the word "" in the list box that says "Installation Scripts" ("Imports" in CobCom 1.02 or earlier). That's where you'll be editing the macro code that performs the actual object removal. Click in the edit box. Go ahead and delete the line that appears there. Now type in the following: inst enum 2 6 65 kill targ next scrx 2 6 65 1 endm Now, let's examine each line one by one. inst This command tells the object injector to execute the rest of this script before updating anything in the game. Since we're doing this all at once, it makes sense to go ahead and use this. Anyway, all scripts in the Imports section require this. enum 2 6 65 This will cycle through all the cheese variant objects in the world and delete them. We could just as easily have made it a little more open-ended, though, and deleted all food from the world. To do that, you would use enum 2 6 0, where the 0 is a wildcard, saying that any species will do, as long as it is family 2, genus 6 (i.e., food). kill targ This destroys the object we're looking at right now. Since we're in the middle of an enum command, this deletes one of the cheese variant objects. next Finds the next cheese variant object and repeats the code right after the enum command. If there are no more objects, it skips ahead to the next command. scrx 2 6 65 1 Kills the script that was installed by the object. endm Ends the macro. We've now deleted both the object and the script it contains. Step 3: Cleanup It's important that we delete the script that still says "". That used to be where the scrx command was used, but the new remover format does this right in the installation script. That's really a better way, so let's delete this leftover script. Go to the Scripts menu and select "Delete Script". You should now see only an installation script left--that's all we need. Step 4: Moving On You may want to change the name of the object to lesson1.RCB (or "cheese variant.RCB", or whatever the heck you called that cheese variant from Lesson 1), since the new object injector uses RCB objects to remove an object with a matching filename. I've included both lesson2.COB and the identical lesson1.RCB in the file on the Downloads page. Well, now you have an object that can delete your cheese variant. It doesn't need a class of its own, since it's really just a script. If you added to the cheese variant by adding new scripts, then you'll have to change the remover as well. For example, if you added the script scrp 2 6 65 4 to the original, then you'll have to add a line to the remover's installation script that says scrx 2 6 65 4.