Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Open Windows Explorer
Sprite generation
Volume Control Dial
CD-ROM Drive Letter Finder-Using a File
Set PlayBackMode of a Flash Sprite
DirectImage Xtra
PowerPoint / PPT Access
Rolling a Ball.
Wait for X seconds, go to marker
CSS Class
 

 

 

Article Super Debugging

Added on 10/18/1999

 

Compatibilities:
D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: MediaMacros (website)

I am working on a very large project and am trying to debug the projector. The problem is that I get random errors in places but they are not consistent. Is there a way I can monitor what is going on in my projector?

With Director 7 there are a few documented and undocumented ways to see what is going on in your projector.  In authoring mode it is easy to monitor what is going on with the watcher and the message window.  Wouldn't it be nice to have some of this at runtime?  We, you are in luck.  Here is a little trick that will allow you some control in your projectors by giving you full access to the message window.  If you use a stub and test your unprotected movies, you can query most anything.  For protected movies and projectors with internal files you can still test variables and call handlers but things like tracing and scriptText are off limits.

Lets start with the message window.  If you have done much developing, you know that there are 2 files that Director likes to use to start any conditions at runtime.  They are the "lingo.ini" file, which can run lingo in a startUp handler, and the other is the "projector.ini" file that can modify settings in the projector for sound devices, and other system level parameters.  We are going to be looking at the "projector.ini" file for a little trick that you can use to open that good old message window.

Start with an empty text file or your existing "projector.ini" file.  Rename it to match your projector.  For example, if your projector is named "start.exe" (or just "start" on the Mac) then you would name the file "start.ini"  In it you include this simple text...

[Settings]
MessageWindow=1

This will tell the projector to utilize the message window in the projector.  Now we are off to a great start.  With a few key put statements we can get feedback from the scripts as well as check the status of our variables.  Well, this is nice but what if we want a lot more info.  This is where the "trace" ability comes in.  Trace is available in the message window in authoring mode to display every command and variable change that lingo runs.  If you are using unprotected movies you can have this constantly give feedback on what is happening.  Now when your errors appear, you can see what just happened and what variables are out of place.

Well, we still have a little problem.  This text is now cruising by at light speed and we need to be able to review the data.  Any way to make it a bit easier?  Well there is one more set of lingo commands that can help.  Instead of writing to the message window, we can have the returned values written to a log file.  using the "traceLogFile" property we can have lingo write all value changes and script information to a simple log file for later review.  You can use commands like "showGlobals", "put", etc. to see what is going on "under the hood" while everything plays.  Below is a simple script you can add to any movie and then start from the message window to report back in any projector.

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know. :-)

on startTrace logName, load
  the traceLogFile = the moviePath & logName
  if load = true then traceLoad = 2
  the trace = 1
end

on stopTrace
  the trace = 0
  the traceLogFile = ""
  the traceLoad = 0
end

on getBehaviorDescription me
  describe = "Place this in any movie or projector. Modify your projector.ini file to include the following entry:"
  describe = describe & return & "[Settings]" & return & "MessageWindow=1" & return & "This opens the message window in the projector and allows you to call the startTrace and stopTrace commands."
  describe = describe & return & "logName is the name of the created log file." & return & "Load is a boolean that determines if a members load status is also tracked."
  return describe
end

So what now?  Well, try building some alertHook handlers to report more detailed data.  You could also make a "virtual" watcher as a MIAW that is controlled through the message window.  Check out the authoring utilities page for some other utilities like this, and don't be afraid to create your own!

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail