Farbflash projects: Imaging lingo table | 3-D scene list | Find all | Handler menu | Lingo message window

Ignore:
Timestamp:
09/17/08 20:50:38 (4 years ago)
Author:
alex
Message:

incorporated changes to library scripts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lingosource/castlib2/commonMovieScript.ls

    r184 r186  
    11-- commonMovieScript 
    2 -- was anderes 
    32----------------------------------- 
    43-- CREATED: 
     
    65-- 
    76-- DESCRIPTION:       
    8 --              Shared Global Handlers ©03 Alex da Franca -- alex@farbflash.de 
     7--              Shared Global Handlers c03 Alex da Franca -- alex@farbflash.de 
    98--              ------------------------------------------------------------------- 
    10 --              these handlers are shared between all of my scripts Alex da Franca ©2003 alex@farbflash.de 
     9--              these handlers are shared between all of my scripts Alex da Franca c2003 alex@farbflash.de 
    1110--              for private use of my scripts -> poor documentation -> use at own risk ;-) 
    1211 
     
    12031202on mGetInstance me, instName, useRawNew 
    12041203   
     1204  if ilk(instName) = #string then instName = symbol(instName) 
     1205   
    12051206  theGlobs = mGetGlobalList(me) 
    12061207  gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 
     
    12141215  if ilk(saveScr) = #instance then return saveScr 
    12151216   
    1216   if mGetMemType(me, member(instName)) = #script then 
    1217     if useRawNew = 1 then saveScr = rawnew(script instName) 
    1218     else saveScr = new(script instName) 
     1217  if mGetMemType(me, member(string(instName))) = #script then 
     1218    if useRawNew = 1 then saveScr = rawnew(script string(instName)) 
     1219    else saveScr = new(script string(instName)) 
    12191220    gParentScriptInstances.setaprop(instName, saveScr) 
    12201221    return saveScr 
     
    12231224  if saveScr = -1 then return 0 
    12241225  gParentScriptInstances.setaprop(instName, -1) 
    1225   inst = mGetXScript(symbol(instName)) 
     1226  inst = mGetXScript(instName) 
    12261227  if not(listP(inst)) then 
    12271228    if ilk(inst) = #instance then inst = inst.script 
     
    12551256 
    12561257-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    1257 -- xxxxxxxxxxxxxxxxxx reload a stored script instance: 
    1258  
    1259 on mReloadInstance me, instName 
     1258-- xxxxxxxxxxxxxxxxxx delete a stored script instance: 
     1259 
     1260on mDeleteInstance me, instName, dontCallDestroyHandler 
    12601261  theGlobs = mGetGlobalList(me) 
    12611262  gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 
    1262    
    12631263  if ilk(gParentScriptInstances) <> #proplist then exit 
    1264    
     1264  if dontCallDestroyHandler <> 1 then 
     1265    saveScr = gParentScriptInstances.getaprop(instName) 
     1266    if ilk(saveScr) = #instance then call(#mDestroy, [saveScr]) 
     1267  end if 
    12651268  gParentScriptInstances.deleteprop(instName) 
     1269end 
     1270 
     1271 
     1272-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1273-- xxxxxxxxxxxxxxxxxx reload a stored script instance: 
     1274 
     1275on mReloadInstance me, instName, useRawNew, dontCallDestroyHandler 
     1276  mDeleteInstance me, instName, dontCallDestroyHandler 
     1277  return mGetInstance(me, instName, useRawNew) 
     1278end 
     1279 
     1280-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1281-- xxxxxxxxxxxxxxxxxx replace a stored script instance: 
     1282 
     1283on mReplaceInstance me, instName, scriptInstance, dontCallDestroyHandler 
     1284  if not(objectP(scriptInstance)) then exit 
     1285  theGlobs = mGetGlobalList(me) 
     1286  gParentScriptInstances = theGlobs.getaprop(#gParentScriptInstances) 
     1287  if ilk(gParentScriptInstances) <> #proplist then exit 
     1288  if dontCallDestroyHandler <> 1 then 
     1289    saveScr = gParentScriptInstances.getaprop(instName) 
     1290    if ilk(saveScr) = #instance then call(#mDestroy, [saveScr]) 
     1291  end if 
     1292  gParentScriptInstances.setaprop(instName, scriptInstance) 
    12661293end 
    12671294 
     
    18601887end 
    18611888 
     1889-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1890-- the naming convention used throughout all my movies for names, filename etc.: 
     1891-- Names must be only alphanumeric chars and the underscore and should not start with a number 
     1892-- As a rule of thumb: every string which can be made into a symbol is valid. 
     1893 
     1894on mValidateName me, str 
     1895  if ilk(str) <> #string then return 0 
     1896  if length(str) < 1 then return 0 
     1897  if "0123456789" contains char 1 of str then return 0 
     1898  return string(symbol(str)) = str 
     1899end 
    18621900 
    18631901-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     
    19571995end 
    19581996 
     1997 
     1998-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     1999 
     2000on mFormatdate me, theFormat, theDate 
     2001  theFormat = string(theFormat) 
     2002  if length(theFormat) < 1 then theFormat = "yyyy/mm/dd" 
     2003  if ilk(theDate) <> #date then theDate = the systemdate 
     2004   
     2005  offs = offset("y", theFormat) 
     2006  if offs > 0 then 
     2007    ende = offs+1 
     2008    repeat while char ende of theFormat = "y" 
     2009      if ende > length(theFormat) then exit repeat 
     2010      ende = ende+1 
     2011    end repeat 
     2012    len = ende - offs 
     2013    if len < 3 then theYear = char 3 to 4 of string(theDate.year) 
     2014    else theYear = string(theDate.year) 
     2015    put theYear into char offs to offs + len -1 of theFormat 
     2016  end if 
     2017   
     2018  theFormat = mReplaceCharWithNumber(me, theFormat, "m", theDate.month) 
     2019   
     2020  theFormat = mReplaceCharWithNumber(me, theFormat, "d", theDate.day) 
     2021   
     2022  return theFormat 
     2023end 
     2024 
     2025-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     2026 
     2027on mReplaceCharWithNumber me, theString, theChar, theNumber 
     2028  offs = offset(theChar, theString) 
     2029  if offs > 0 then 
     2030    ende = offs+1 
     2031    repeat while char ende of theString = theChar 
     2032      if ende > length(theString) then exit repeat 
     2033      ende = ende+1 
     2034    end repeat 
     2035    len = ende - offs 
     2036    theNumber = string(theNumber) 
     2037    repeat while length(theNumber) < len 
     2038      put "0" before theNumber 
     2039    end repeat 
     2040    put theNumber into char offs to offs + len -1 of theString 
     2041  end if 
     2042  return theString 
     2043end 
     2044 
    19592045-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
    19602046 
Note: See TracChangeset for help on using the changeset viewer.