unload data from and/or within the markers
______________________________________________________________________________________________

-- This behavior unloads data from the markers
-- put the marker names from which and upto which marker you want to unload
-- Beta version
-- tushonline@hotmail.com


Property unload, markerlist, mymarker, from, to,

on resolve me
--This handler is used to convert non-English languages to Lingo terms.
case myMarker of
"next":
myMarker = #next
"previous":
myMarker = #previous
end case
end on


on getPropertyDescriptionList me

currentMember = sprite(the currentSpriteNum).member

markersList = GetMarkers (me)
if markersList.count() = 2 then -- [[], []]
ErrorAlert (me, #getPDL_DuplicateMarkers, markersList[2])
end if

tLabelList = []
tLabelList.add("next")
tLabelList.add("previous")

repeat with i = 1 to count(the markerList)
tLabelList.add((the markerList).getProp((the markerList).getPropAt(i)))
end repeat
pList = [:]
addProp pList,#from,[#default:#getmarkers, #format:#marker,#comment:"Select the Marker you want to 'Unload From'"]
addProp pList,#to,[#default:#getmarkers, #format:#marker,#comment:"Select the Marker for 'Unload To'"]
return pList
end


--get markers

on GetMarkers me -- Sent by getPropertyDescriptionList
localMarkerList = []
duplicatesList = []
markerString = the labelList
delete the last char of markerString
markerCount = the number of lines of markerString
repeat with i = 1 to markerCount
theMarker = markerString.line [i]
if localMarkerList.getPos(theMarker) then
-- Duplicate marker name
if not duplicatesList.getPos(theMarker) then
duplicatesList.append(theMarker)
end if
else
localMarkerList.append(theMarker)
end if
end repeat
if duplicatesList.count() then
return [localMarkerList, duplicatesList]
else
return [localMarkerList]
end if
end GetMarkers

on exitFrame me
unload from, to
end

on getBehaviorDescription me
return "THIS BEHAVIOR UNLOADS DATA FROM THE MEMORY WITHIN SPECIFIED MARKERS" & RETURN & "THIS IS A BETA VERSION & THIS IS as is AND AUTHOR DOESNOT TAKE ANY RESPONSIBILITY IF THIS WONT WORK" & RETURN && RETURn & "use this as a FRAME SCRIPT or attach it to any sprite...This works on exitFrame handler" & RETURN & "ANY SUGGESTIONS OR BUG REPORT ARE GREATLY APPRECIATED" & RETURN & "tushonline@hotmail.com"
end

on getBehaviorTooltip
return "THIS BEHAVIOR UNLOADS DATA FROM THE MEMORY WITHIN SPECIFIED MARKERS" & RETURN & "THIS IS A BETA VERSION & THIS IS as is AND AUTHOR DOESNOT TAKE ANY RESPONSIBILITY IF THIS WONT WORK"& RETURN && RETURn & "use this as a FRAME SCRIPT or attach it to any sprite...This works on exitFrame handler" & RETURN & "ANY SUGGESTIONS OR BUG REPORT ARE GREATLY APPRECIATED" & RETURN & "tushonline@hotmail.com"
end