Using Director > Writing Scripts with Lingo > Using linked scripts

 

Using linked scripts

In addition to scripts stored as internal cast members, you can choose to keep scripts in external text files and link them to your Director movie. These linked scripts are similar to linked image or digital video files you can import into Director movies.

Advantages of using linked scripts include the following:

One person can work on the Director file while another works on the script.

You can easily exchange scripts with others.

You can control the scripts separately from the Director file in a source code control application such as Microsoft Visual SourceSafe. Applications such as this prevent multiple programmers working on the same Director project from overwriting each other's work.

Linked scripts are used by Director only during authoring. At run time, Director projectors and Shockwave use a special internal copy of the script data stored in the movie. This way, your linked scripts need not be distributed with your movies and cannot be copied by end users.

To import a script as a linked text file:

1

Choose File > Import.

2

Choose Script as the type of file to import.

3

Select the script file(s) you want to import.

You can import files with the file extensions .txt or .ls; the .ls extension is Director's linked script extension.

To create a list of files you want to import, you can use the Add and Add All buttons. This is especially useful if you want to import scripts from multiple locations.

4

Select Link to External File from the Media pop-up menu.

5

Click Import.

You can edit linked scripts normally in Director's script window. Changes you make are written to the external files each time you save your Director movie. (If you imported the linked script from a UNIX server, UNIX line endings are preserved.) If you import a script whose text file is locked, you will not be able to edit the script in Director.

You cannot apply custom text colors to linked scripts in the script window. Script auto coloring, however, is enabled for linked scripts.

To turn an internal script cast member into an external, linked script cast member:

1

Select the internal cast member and click the Script tab of the Property Inspector.

2

Click Link Script As.

3

Enter a name for the script file in the Save As dialog box.

4

Click Save.

To reload a linked script after it is edited:

Use the unloadMember command.

If a linked script is edited outside of Director, you can reload it by using the unloadMember command in the Message window. The following statement will cause the script myScript to be unloaded and then reloaded:

unloadMember member "myScript"