Articles Archive
Articles Search
Director Wiki

Where oh where did my globals go?

November 18, 1998
by Alex Zavatone

ShowGlobals is one of the first commands that gets discovered when you're working on getting started with Director. And not too far after, you learn that showGlobals -- along with some other commands -- only dumps its output to the message window. You can't ask Director to dump the values into a field or other location. This can be a real pain when you can't remember all your global names and want to get some values or create a window that monitors your globals for you.

Back in the Director 4 days, I got sick of this limitation and thought that if you could read through all the scripts you could find and store a list of global values and then use the "do" command to get the value of the fetched globals. From that, I built an authoring tool MIAW to monitor all your global variables for you. Something that often comes in handy for me.

Recently, there has been renewed discussion on the Direct-L about "how to get my globals to display outside the message window". With renewed interest, I dug up my old code and sent it off to Chris Allert who spiffed it up and added multi castlib support. The resulting chunk of code consists of 4 handlers that you can call to get your list of globals and display their values.

Note: this code is meant to be run from either the stage or a miaw.

Handlers Function
GetGlobalList() returns a list of all globals that are declared inside a handler
ParseGlobalLineList globalLineList parses the globals out of the text string returned (private)
DisplayGlobalValues theGlobalList displays the globals and their values
GhGlobalValues() returns a property list of the globals and their values

To get a list of globals, simply issue the following line:

put GetGlobalList()


set myGlobalList = GetGlobalList()

to display the values of all globals,

put DisplayGlobalValues( GetGlobalList( ))


set myGlobalList =DisplayGlobalValues( GetGlobalList( ))

to return a property list of all the globals and their values,

set myGlobalList = GhGlobalValues()

And there you have it!

Possible modifications to this code are to make it non repeat based so that other actions can happen while it is finding all the globals and global info.

Many thanks to Chris Allert who got the thread going again and brought the code up from the mid 90's to the late 90's.

Download the castlib in Macor PC format

A Director user since 1987, Alex (Zav) Zavatone has worked on the engineering teams for both Director and Shockwave, 4, 5, 6 and 7. Recent investigations find him developing foundation classes for Director with asynchronous process management and other life threatening activities. In its early days, he had something to do with this Internet thing known as "DOUG". A noted ne'erdowell, slacker and laggard, Mr. Zavatone is nonetheless is trusted by children, small animals and the elderly. In his spare time, Mr. Zavatone rehabilitates lame desert trout.

Copyright 1997-2017, Director Online. Article content copyright by respective authors.