User Guide
976 Chapter 14: Properties
Example
This handler displays the list of script references attached to a sprite:
on showScriptRefs spriteNum
put sprite(spriteNum).scriptInstanceList
end
These statements attach the script Big Noise to sprite 5:
x = script("Big Noise").new()
sprite(5).scriptInstanceList.add(x)
See also
scriptNum, sendSprite()
scriptList
Usage
sprite(whichSprite).scriptList
the scriptList of sprite whichSprite
Description
Sprite property; returns the list of behaviors attached to the given sprite and their properties.
This property may only be set by using
setScriptList(). It may not be set during a score
recording session.
Example
This statement displays the list of scripts attached to sprite 1 in the Message window:
put sprite(1).scriptList
-- [[(member 2 of castLib 1), "[#myRotateAngle: 10.0000, #myClockwise: 1,
#myInitialAngle: 0.0000]"], [(member 3 of castLib 1), "[#myAnglePerFrame:
10.0000, #myTurnFrames: 10, #myHShiftPerFrame: 10, #myShiftFrames: 10,
#myTotalFrames: 60, #mySurfaceHeight: 0]"]]
See also
setScriptList(), value()
scriptNum
Usage
sprite(whichSprite). scriptNum
scriptNum of sprite whichSprite
Description
Sprite property; indicates the number of the script attached to the sprite specified by
whichSprite. If the sprite has multiple scripts attached, scriptNum sprite property returns the
number of the first script. (To see a complete list of the scripts attached to a sprite, see the
behaviors listed for that sprite in the Behavior Inspector.)
This property can be tested and set during Score recording.