What's New in Director 8.5 > Multiuser Server-Side Scripting > About server-side scripting > Loading the Scriptmap.ls file |
![]() ![]() ![]() |
Loading the Scriptmap.ls file
After creating the Dispatcher script, the server calls the Dispatcher's on initialize
handler. This handler sets up some variables and then calls the Dispatcher.ls file's on loadScriptMapFile
handler and passes it the Scriptmap.ls file name. The on loadScriptMapFile
handler uses file-access Lingo (see Accessing files on the server) to read the Scriptmap.ls file and assigns its contents to a string variable. This string variable is then converted to a script object with the createScript()
function.
The on loadScriptMapFile
handler then calls the Scriptmap.ls file's on scriptMap
handler. The default on scriptMap
handler looks like this:
on scriptMap theMap = [] --theMap.Append( [ #movieID: "BlackJack*", #scriptFileName:\ "BlackJack.ls" ] ) --theMap.Append( [ #movieID: "Debug", #groupID:"@DebugGroup",\ #scriptFileName: "Debug.ls" ] ) return theMap end
This handler returns a list of property lists, each containing a movie ID and a script file name. Each of these property lists is used by the server to associate a specific movie ID that might log on to the server with a specific script file located in the server's scripts folder. The two lines beginning with theMap.append
are commented because they refer to example movies you may or may not want to activate on the server.
The Dispatcher script next uses file-access Lingo to read these script files and convert them to script objects with the createScript()
function. Once each script object is created, it is ready to receive and handle events from its associated movie.
![]() ![]() ![]() |