Basically, you use:
ontouch{
#your code here
#code
#code
#more code
#etc
}
In the scripted field. The code you put between the brackets will be executed, in the case of ontouch, upon every collision with another object. ontick{...}, onuntouch{...}, and ontouching{...} work in basically the same way, with ontick executed every frame, onuntouch whenever the object stops colliding, and ontouching every frame the object is colliding with another. With any of the the touch events, you can also access the object being collided with, the exact point3d of the collision, and the impact speed of the collision, using:
ontouch{|toucher,speed,pos|
#code
}
You can then use them as variables in your event code.