The Xtra has four global handlers (one specific for Macintosh and one for Windows):
voidP (aValue)
Replaces Lingo built-in handler.Returns 0 if aValue is not a void variable.
Returns 1 If aValue is void, and is considered as equivalent to false when used in a boolean test.
Returns 2 If aValue is void, but is equivalent to true in a boolean test (this could be considered a bug, as a void value should always be considered equivalent to zero or a boolean false).
Look here for an explanation of why this handler could be useful...
testValue (aValue)
Returns a property list with the type and the content in memory of aValue. A few example will explain this better (tested with Director 7 on a Macintosh - The type number may be different for other versions):put testvalue (void)-- [#ty: 2, #it: 0]
A void value has the internal representation of type 2 and content 0 for Director. If the content is not 0, then we may have the source of the bug (feature?) and the net result will be that our if-then test will branch in the wrong way, as noted in the above message.
put testvalue (1)-- [#ty: 4, #it: 1]
An integer value has type 4 and content 1.
put testvalue (#a)-- [#ty: 8, #it: 1913]
A symbol value is of type 8, and the symbol #a has the number 1913 in Director internal symbol table.
put testvalue (1.1)-- [#ty: 35, #it: 43477472]
A floating-point number has type 35, and the content here is the absolute address in memory where the floating-point data is located.
put testvalue ("a")-- [#ty: 67, #it: 48057576]
A string variable has type 67, and the content here is the absolute address in memory where the string is located.
There is also something special added for 3D Vector() type introduced with Director 8.5: a way to uncover the hidden w field:
put testvalue (vector ())-- [#ty: 3, #it: 173950472, #vector: [#x: 0.0000, #y: 0.0000, #z: 0.0000, #w: 1.0000]]
setW aVector, w
set the (hidden) w component of a vector to a new value. w should be an integer or a float value:v = vector()
res = setW (v, 2.0) -- or setW (v, 2)
if res then
put testValue (v)
else
put "failed"
end f-- [#ty: 3, #it: 173950472, #vector: [#x: 0.0000, #y: 0.0000, #z: 0.0000, #w: 2.0000]]
Keep in mind that vector data are 32 bit float, not the 64 bit float Director use for normal floating point values.
fpReset
Windows only handler. Reset the FPU to its normal state. May help you to fix a crash in Director (exception 10H) when there is a (buggy) printer driver installed (old HP or Xerox printer drivers are good candidates). Use that command just after you have done something that may have involved a call to the printer driver and just before updating Director stage.Have a look at the following URL for background information on the problem (or do a Google search on "Windows crash exception 10H):
http://www.aresforact.com/support/1001.htm
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q183522
classicMac
Macintosh only handler. Returns 1 if the Director session (authoring or projector mode) is running under the classic environment in Mac OS X and returns 0 otherwise. Always returns 0 with the carbon version of the xtra running under Mac OS X (at the moment only Shockwave has been released for Mac OS X).
Download the Windows or Macintosh (classic and carbon) version of the Xtra (that is free for you to use, redistribute, do what you want..).
If you find this Xtra useful, you may find also my vList Xtra useful too (you can use it to save efficiently your vector() and transform() data to disk...)
Daniel Devolder, November 11 2002
Free counters provided by Andale.