There are 3 main types of lights:
Point lights which radiate a sphere of light in all directions, and Spotlights which radiate a cone of light in a specified direction. These lights are placed in the scene at (what we hope is) the most advantageous position. How these lights affect a surface is dependent on the angle between the rays from the light and the surface normal for the current micropolygon. If the surface normal and the light ray are pointing directly at one another, that micropolygon then receives the full effect of the light's color and intensity. But as the surface along with its normal bend away from the light, or as the light ray shifts away from the surface, that effect fades. Light shaders may also be written such that the light will fade off, the further away the light is from the surface. This is called attenuation.
Distant lights represent lights so far away that all the rays appear to run parallel in a single direction, such as sunlight. These lights do not need a specific location, but must be given a direction for the rays. Their contribution to the surface lighting is also dependent on the angle between that direction and the surface normal for any given micropolygon. If attenuation is desired for a distant light, then that light must also be given a location.
To change the above example to a spotlight, just delete the ambientlight box and replace it with the spotlight box. Below is the light_checked.stree from the ShadeTree examples directory:
Now if you want to use a texture map instead of a pattern. Basically you can just replace the checks box with a Functions->Map->texture box. However in order to align the center of the image with the light direction vector, 0.5 is added to the shading point, Ps. The resulting X and Y values are used as the s and t coordinates into the map. Notice that since the output from a texture map is usually a color, it is connected the LGT button, instead of the INT button. This is the light_texspot.stree from the ShadeTree examples directory: