User Tools

Site Tools


crpl:crpltutorial:interactive:scripting

<-CW3 Home <-CRPL Home <-Interacive tutorials

Creating your own scripts

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.

Step 1

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.

Step 2

(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.

Step 3

Look up the commands you'll need but don't know yet in the CRPL reference.

Step 4

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).

Step 5

Repeat these steps if you want to add extra function to your script or if you want to add more scripts to your map.

Good script/map making practices/hints

  • Never create big maps without good plans.
  • Use 96×63 or 128×96 if you don't know the size yet (256×192 if you know for sure your map is going to be huge).
  • If needed, you can change the map size later in the editing process.
  • Put the player in some kind of danger (not necessary within the first few minutes)
  • If possible, add new kind of danger when a certain condition is met instead of time-based conditions. This makes your map fun for those who don't play for fast times as well as those who do.
  • Play and review other maps, you can learn a lot from them!
  • Make sure your terrain textures look nice together. Smooth red and textured green hardly ever look good together.
  • Try to avoid the original CRPLcore image. Only use them if you want the player to know that the map uses CRPL.
  • Add sounds to special CRPL events, helps players understand what's going on.
  • Remember there are always people who play with their sound turned off.
  • Add comments to your CRPL scripts (using the #hashtag)
  • Organising your script helps you and other coders to understand it better.
  • If you're stuck debugging your script request help on the forum in the Coder's Corner subforum.
  • Before putting your script on the forum make sure it is well-organised so others can understand it. They haven't seen the script before and they don't know what each variable is meant to hold/do!
  • Using warp notation can help organising your script when used correctly, otherwise it will ruin your whole script! If that's the case, remove them all (putting commands back in their original order) and ask help on the forum how to do it correctly.
crpl/crpltutorial/interactive/scripting.txt · Last modified: 2018/07/11 11:16 by builder17