Overlays

Overlays serve a function similar to that of code libraries in other languages, namely collecting and encapsulating code in a particular category or domain and making it easy add and remove these collections of code as a group to projects.

However, all SkookumScript overlays are essentially open and build successively on top of one another starting with the Core overlay. They are somewhat analogous to layers in a graphic image editing program where each layer has some new visible content and also covers some content of earlier layers. Similar to image layers, each overlay can add more content which can be entirely new or it may also supersede content from a previous overlay. All the overlays for a project are flattened together and the resulting visibile content is the code base used for a SkookumScript project.

Related coding constructs include:

  • overriding which has routines inherited from a superclass superseded with same named alternate routines in a subclass. Overriding is also supported in SkookumScript.
  • overloading which has routines with the same name though with different parameters. Overloading is intentionally not supported in SkookumScript.

SkookumScript overlays add the construct of overlaying whole libraries to add and supersede collections of code over the earlier overlays.

Each overlay has a rank and overlays are applied in rank order. So code in a rank 1 overlay is added first, then the rank 2 overlay goes over top of that, then the rank 3 overlay on top of that, and so on. The Core overlay is always rank 1 - it has all the standard SkookumScript classes and routines such as Object, String, Integer, Boolean, List and Mind.

The current overlays for a project can be viewed in the SkookumIDE in the Overlays widget.

SkookumIDE Overlays widget

The Overlays widget. Disabled overlays are in a darker font and the overlay of the currently selected member has its line highlighted.

Whenever you use the New Class or Member pane in the Members widget you must specify the overlay that new classes and members belong to.

As you are looking at or editing script files, the Overlays widget will highlight the overlay location of the current member.

Overlay files

Overlays are specified in the MyProject\Scripts\Skookum-project.ini project settings file. The default overlays are usually sufficient for most projects.

TIP The current SkookumIDE doesn’t have a dialog to modify overlays yet – so overlay settings are currently modified by hand.

Example overlay section from the “SkookumDemo” project:

1
2
3
4
5
6
7
8
9
[Script Overlays]
Overlay1=*Core|Core\
Overlay2=-*Core-Sandbox|Core-Sandbox\
Overlay3=*VectorMath|VectorMath\
Overlay4=*Engine-Generated|Engine-Generated\|A
Overlay5=*Engine|Engine\
Overlay6=*Project-Generated|Project-Generated\|1
Overlay7=SkookumDemo|Project\
Overlay8=-Sandbox|Sandbox\

Notes on the project file overlay format

  • the overlays are applied in increasing order so Overlay5 will replace matches in Overlay4
  • there can be no gap in the overlay rank numbers
  • the first section (delimited with |) in an overlay entry is the name of the overlay
  • the second section in an overlay entry is the file path where the script files for the overlay are located
  • overlays that start with a minus - are disabled (essentially commented out)
  • overlays that start with an asterisk * are set to be read-only since they are either generated or come from the SkookumScript team. You can of course remove the asterisk and edit layers such as Core if you want to modify them to contribute scripts back to other teams using SkookumScript
  • overlays ending with a third section indicate either to use |# a particular folder depth (since some OSes still limit the max number of characters in folders) or |A which is only valid for generated overlays and indicates that all the scripts are stored in a single archive file named !Overlay.sk (hence the “A”)

If you have any additional questions or thoughts on overlays, see this post on the SkookumScript Forum: