This page is about the basics of writing your own scripts from scratch, basic workflow and a few things you need to keep in mind while scripting. All shortly explained step by step.
As this is in the advanced section, I assume you already know how to create, compile and attach scripts. So I will not describe that part of the scripting in detail.
The first step is the most important step and that is to think about what you want before you start scripting. If you don't know what you are trying to create it won't get anywhere near what you want. Say you are creating a single challenging tower and you start adding stuff like RandCoords 10 QueueMove 100 Addcreeper it will get hard, unpredictable and not fun at all. Think about what you want and then continue to the next step.
(advanced map-dominating scripts only) You might not have expected it to be step 2, and if you want you can skip this step. Step 2 is to create the terrain of the map. This defenitely helps to visualise what you are trying to script and if it needs specific coords, you can look them up in the map. If you don't know what size your map is going to be, either use 128×84 or 96×63.
Look up the commands you'll need but don't know yet in the CRPL reference.
Now you got your idea's up, create your script. If needed, go back to step 3. If you can create a basic framework that works for any kind of map, try to create a portable framework and work out your script from there. If there's any kind of custom fuction that uses multiple lines to for example get the furthest unit within a set range, put that in a function so you can use it in other blocks of code and you get a better overview of what your script does (if you give the function a good name).
Repeat these steps if you want to add extra function to your script or if you want to add more scripts to your map.