If you use the Dynamic Attachers, then use wfsRemoveScriptAndRunEndSprite to remove the behavior.
This runs the endSprite handler of only theScriptName which is attached to theSpriteNum, if theScriptName does indeed have an endSprite handler, and then de-attaches the first instance of the script named theScriptName from the sprite with spriteNum=theSpriteNum, if the script is indeed attached to it. This handler will detach scripts attached to dynamic and non-dynamic sprites. This handler first checks to see if the behavior is attached (via a call to wfsScriptIsAttached). It returns 0 if the script is not attached to theSpriteNum.
theSpriteNum: This is the spritenum of the sprite you want to remove the behavior from.
theScriptName: This is the (string) name of the script you want de-attached.
It returns 1 if the script was successfully de-attached, and 0 otherwise. If there are multiple instances of the script attached to theSpriteNum, then only the first instance is removed.
theBooleanResult = wfsRemoveScriptAndRunEndSprite(4, "some behavior")
The below runs the endSprite handler, if it exists, in the "some behavior" behavior attached to sprite 4 (if "some behavior" is indeed attached to sprite 4), and then detaches the first instance of this script from sprite 4 (if there are any such instances to detach).
This is for determining whether a particular script is attached to a particular sprite. You can call wfsScriptIsAttached on dynamic and static sprites.
theSpriteNum: This is the spritenum of the sprite you want to inspect.
theScriptName: This is the (string) name of the script you want to check for.
This returns an index into sprite(theSpriteNum).scriptInstanceList at which the script named theScriptName is located, if the script is indeed attached to theSpriteNum. It returns 0 otherwise. For instance, if this handler returns 3, then sprite(theSpriteNum).scriptInstanceList is an instance of theScriptName.
theResult=wfsScriptIsAttached(5, "some behavior")
The above determines whether the behavior named "some behavior" is attached to sprite 5. If it is, then theResult will be a positive integer indicating the index of the first instance of "some behavior" in sprite(theSpriteNum).scriptInstanceList
Returns a list containing the names of the behaviors attached to theSpriteNum.
theSpriteNum: The spritenum of the sprite you want to examine.
A linear list of strings. The strings are the names of the behaviors attached to theSpriteNum.
theListResult = wfsGetScriptNameList(5)
The above returns a list of the names of the behaviors attached to sprite 5.
This is called by code generated by wfsWriteMultiSprite to generate the name of a dynamic multi-sprite. The name of an instantiated multi-sprite must be unique among all instantiated multi-sprites. This handler generates a name that is unique among instantiated multi-sprites.
Also, if we dynamically generate a family of multi-sprites, there may be links among them. For instance, menus generally open submenus that are part of the same family. So the Script Writer has not only to come up with a unique name, but it has to be cognizant of links among the family.
Multi-sprites generated by code returned by wfsWriteMultiSpriteFamily (which calls wfsGenerateManagerName with a non-void familyIdentifier parameter) have names that have three components separated by the "+" symbol. So these names are not really appropriate for display to the user. The first component is the name of the static model multi-sprite. The second component is the name of the multi-sprite at which you aimed wfsWriteMultiSpriteFamily. The third component is a number indicating the number of dynamic copies of this family.
Multi-sprites generated by code returned by wfsWriteMultiSprite (which calls wfsGenerateManagerName with a VOID familyIdentifier parameter) have names that have two components separated by the "+" symbol. The first component is the name of the static model multi-sprite. The second component is a number indicating the number of dynamic copies of this multi-sprite.
theManagerName is the string that names the multi-sprite on which the dynamic multi-sprite is modelled.
theFamilyIdentifier is a parameter that is VOID unless we are generating a family of multisprites. Note that when wfsWriteMultispriteFamily calls wfsWriteMultiSprite, it specifies theFamilyIdentifier.
Returns a name you can name the dynamic multi-sprite with, ie, no other instantiated multi-sprite will have this name.
The code below was generated by wfsWriteMultiSprite. Note that it makes a call to wfsGenerateManagerName before the dynamic manager is created.
on wfsCreatemenu111E36F570 (familyIdentifier)
This returns a list of the spritenums of managers that are descendants of theManagerSpritenum, and the list also includes theManagerSpritenum at the start. This handler is recursive. It is called by wfsWriteMultiSpriteFamily.
This returns the number of sprites in the family (tree) of multi-sprites rooted at theManagerSpriteNum. This handler is called by wfsWriteMultiSpriteFamily.
This returns the concatenation of two linear lists a and b.
This searches input for occurrences of stringToFind and replaces them with stringToInsert. It returns the search and replace string. For instance, wfsSearchAndReplace("abcd", "bc", "x") would return "axd".