What's New in Director 8.5 > Multiuser Server-Side Scripting > Adding server-side scripts > About server-side script objects

 

About server-side script objects

The script objects created by the server with the createScript() function are different from most other script objects created at run time. They are not child objects but are similar to Director's script cast members. When the server reads an LS file containing a script, it gets only the string contained in the file. In order to treat that string as a working script, the server must create a script object from it with the createScript() function. Once the string has been converted to a script object, it is available to the LingoVM Xtra and can be thought of as a script cast member, with handlers that can be called by the server, connected movies, or other scripts.

By default, these script objects are created as parent scripts. However, for them to function as true parent scripts, you must choose to write the script for a movie in such a way that it can birth child objects by reading additional script files and creating child objects from those scripts with the new() function.

To create a global script with the createScript() function, you must include a #global argument with the function. See createScript() in the Multiuser Lingo Dictionary.

These statements create a parent script from the text of the file testScript.ls:

scriptText = file("testScript.ls").read()
scriptObject = createScript(scriptText, #global)

Whether true parent scripts or global scripts are appropriate for a particular situation depends on the movie and the author's judgment.

The GameScript file contains a script that acts like a client and manages the logic required for the game.