-- About -- With this library you can place signs in the scenario editor and then use this library to query the locations of those signs. When you initialize the library it will remove all the label signs from the map and only store their location in memory. -- Save/Load -- To work with save/load it provides functions to export/import from save game. All you need to do is to store the return value from the export function in your save table and then pass it to the import function. -- CompanyMode -- This library doesn't create any company mode instances. However, if you have a company mode active, it will affect which signs that can be seen by the library. -- Prefix -- A string that signs must start with to be used as a label sign. All signs that start with this prefix will be removed from the map when they are read by ReadFromMap, so pick a prefix that don't clash with informative labels that you intend your players to see. -- Example -- On a scenario, place a sign "$L=TriggerTree" on a tile that contains a tree. Squirrel code: // Mind that the version number here might not have been updated // to the latest version of the library. Also mind that when you // bind a GameScript to a library on BaNaNaS you can as of 2012-02-18 // only pick the latest version of a library. Reflect that version // number in your import statement, or you will cause problems for // new users. import("scenario.tilelabels", "TileLabels", 1); class YourGS extends GSController { tile_labels = null; save_data = null; constructor() { this.tile_labels = TileLabels("$L="); this.save_data = null; } } function YourGS::Start() { //// Initialization of YourGS //// // Import from save if a save was loaded if (this.save_data != null) { this.tile_labels.ImportFromSave(this.save_data.tile_labels); } // Read labels from map this.tile_labels.ReadFromMap(); // Get the location of the trigger tile local trigger_tile = this.tile_labels.GetTile("TriggerTree"); //// Start the game //// this.Sleep(1); local triggered = false; while(true) { if (!triggered && !GSTile.HasTreeOnTile(trigger_tile)) { // Trigger some interesting event when the tree is cleared GSSign.SetSign(trigger_tile, "You bastard!"); triggered = true; } } } function YourGS::Load(version, table) { this.save_data = table; } function YourGS::Save() { local table = {} table.tile_labels <- this.tile_labels; }