on TurnSpritesOff parameter
-- Loren Mork, Seattle, Wa, Lmork@aol.com
-- v1.0 1998
-- TurnSpritesOff is a handler that turns a single sprite or
-- groups of sprites visibility to false, or zero.
-- Basically it turns them off.
-- See handler "TurnSpritesOn" for the inverse effect.
-- This handler needs at least one parameter to function, but can
-- have as many as desired.
-- Parameters are either single sprites seperated by a comma:
-- TurnspritesOff 2,6,19,200,201
-- The above example turns off sprites 2,6,19,200, and 201
-- Or parameters are linear lists composed of two numbers:
-- the bottom of the range you want shut off,
-- and the top of the range you want shut off.
-- TurnspritesOff [2,10]
-- The above example shuts off sprites 2 through 10
-- in addition, more than one list can be passed
-- TurnSpritesOff [2,10], [15,35], [89,110]
-- The above example shuts off sprites 2 through 10,
-- 15 through 35, and 89 through 110.
-- Lists can be also be mixed with integers
-- in any order
-- TurnSpritesOff [2,10], 25, 31, [60,75], 110, 119
-- The above example turns off sprites 2 through 10, 25, 31,
-- 60 through 75, 110, and 119.
set tParamCount = the paramcount
-- get the number of parameters passed and put in a variable
if tParamCount < 1 then exit
-- defensive check
-- if no parameters then exit
repeat with currentParam = 1 to tParamCount
-- cycle through the list of parameters
put param(currentparam) into tTempParam
-- pull each parameter out put in local variable
-- called tTempParam, and examine it
if not listp(tTempParam) then
-- if it is not a list, then it must be a single number
if tTempParam > 120 then next repeat
-- if it is greater than 120 then ignore it and move on
if tTempParam < 1 then next repeat
-- if it is less than 1 ignore it and move on
set the visible of sprite tTempParam = 0
else
-- must be a list
if count (tTempParam) <> 2 then next repeat
-- only allow lists with 2 elements; ignore if more or less
if ilk(tTempParam,#linearlist) <> 1 then next repeat
-- filter out any property lists and ignore them
set tStartSprite = getat(tTempParam,1)
set tEndSprite = getat(tTempParam,2)
-- coast is clear
-- rip out the two values on the list
-- and put into variables
if tStartSprite > tEndSprite then
-- defensive check to see if numbers reversed
-- if so adjust by using "down to"
repeat with tSprite = tStartSprite down to tEndSprite
set the visible of sprite tSprite = 0
end repeat
else
-- must be correctly formatted
repeat with tSprite = tStartSprite to tEndSprite
set the visible of sprite tSprite = 0
end repeat
end if
end if
end repeat
end TurnSpritesOff
-- TurnSpritesOn is a handler that turns a single sprite or
-- groups of sprites visibility to true, or 1.
-- Basically it turns them on.
-- See handler "TurnSpritesOff" for the inverse effect.
-- This handler needs at least one parameter to function, but can
-- have as many as desired.
-- Parameters are either single sprites seperated by a comma:
-- TurnspritesOn 2,6,19,200,201
-- The above example turns on sprites 2,6,19,200, and 201
-- Or parameters can be linear lists composed of two numbers:
-- the bottom of the range you want shut off,
-- and the top of the range you want shut off.
-- TurnspritesOn [2,10]
-- The above example turns on sprites 2 through 10
-- in addition, more than one list can be passed at a time:
-- TurnSpritesOn [2,10], [15,35], [89,110]
-- The above example turns on sprites 2 through 10,
-- 15 through 35, and 89 through 110.
-- Lists can be also be mixed with integers
-- in any order:
-- TurnSpritesOn [2,10], 25, 31, [60,75], 110, 119
-- The above example turns on sprites 2 through 10, 25, 31,
-- 60 through 75, 110, and 119.
set tParamCount = the paramcount
-- get the number of parameters passed and put in a variable
if tParamCount < 1 then exit
-- defensive check
-- if no parameters then exit
repeat with currentParam = 1 to tParamCount
-- cycle through the list of parameters
put param(currentparam) into tTempParam
-- pull each parameter out put in local variable
-- called tTempParam, and examine it
if not listp(tTempParam) then
-- if it is not a list, then it must be a single number
if tTempParam > 120 then next repeat
-- if it is greater than 120 then ignore it and move on
if tTempParam < 1 then next repeat
-- if it is less than 1 ignore it and move on
set the visible of sprite tTempParam = 1
else
-- must be a list
if count (tTempParam) <> 2 then next repeat
-- only allow lists with 2 elements; ignore if more or less
if ilk(tTempParam,#linearlist) <> 1 then next repeat
-- filter out any property lists and ignore them
set tStartSprite = getat(tTempParam,1)
set tEndSprite = getat(tTempParam,2)
-- coast is clear
-- rip out the two values on the list
-- and put into variables
if tStartSprite > tEndSprite then
-- defensive check to see if numbers reversed
-- if so adjust by using "down to"
repeat with tSprite = tStartSprite down to tEndSprite
set the visible of sprite tSprite = 1
end repeat
else
-- else it must be correctly formatted, so use regular syntax
repeat with tSprite = tStartSprite to tEndSprite
set the visible of sprite tSprite = 1
end repeat
end if
end if
end repeat
end TurnSpritesOn
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA