CartoScripts™ give you the ability to design custom map symbols for lines and points in vector and CAD objects. You can select alternate symbols and vary the symbol elements using attribute values in database tables attached to the element. If line symbols are drawn on a particular side of each line (left or right relative to the start point), you can use the Spatial Data Editor to swap the start and end of individual lines to achieve the correct orientation.
More Style by Script pages:
Basic Style Scripts
Geologic Map CartoScripts
More CartoScript documentation and examples