Changeset 150 for trunk/lingosource/castlib2/commonMovieScript.ls
- Timestamp:
- 02/18/08 06:02:53 (4 years ago)
- File:
-
- 1 edited
-
trunk/lingosource/castlib2/commonMovieScript.ls (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib2/commonMovieScript.ls
r74 r150 1 -- Shared Global Handlers ©03 Alex da Franca -- alex@farbflash.de 2 --------------------------------------------------------------------- 3 4 5 -- these handlers are shared between all of my scripts Alex da Franca ©2003 alex@farbflash.de 6 -- for private use of my scripts -> poor documentation -> use at own risk ;-) 7 8 -- geaendert am 21.06.03 9 -- mGetInstance 0 -- clears all stored instances -> same as recompile all scripts, but that would clear all contents of (script "commonMovieScript").pGList 10 -- mApplyDynamic 11 12 -- alex am 13.03.2004 um 13:49 13 -- added DEBUG_FUNCTIONS 14 15 -- alex am 15.03.2004 um 08:50 16 -- added mGetPlatform() to get OSX 17 -- alex am 31.03.2004 um 11:42 18 -- added clearglobals to mDestroy handler 19 20 -- added support for new director MX2004 sprite names in my handlers by changing mGetKanal() to accept strings 21 22 -- alex am Freitag, 4. Juni 2004 23 -- took care about missing font asset xtra, if it isn't present, we'll get not a script error anymore 24 -- but rather the presence of the font is not checked instead, but rather assumed 25 26 -- alex am 16. Juni 2004 um 10:12 27 -- added mGetNextLowerPowerOfTwo 28 29 -- alex am 18. Juli 2004 um 08:02 30 -- added mMyClearGlobals() to erase the faked globals and get the new globallist 31 32 -- alex am 8. Oktober 2004 um 10:31 33 -- new tempmember handling due to a bug in director 34 35 -- alex am 23. November 2004 um 10:59 36 -- added mGetThisMovieName() and mSetThisMovieName() to identify the movie independant of the filename 37 -- this is needed for some places, where the standard scripts act differently in the different movies 38 39 -- Scriptmarker (21.07.2005 at 11:55 Uhr): changes // Scriptmarker 40 -- added mSplitPath 41 42 43 44 45 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 46 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 47 48 -- IMPORTANT NOTE !! 49 -- if you use my scripts you MUST call 'mCallDestroy()' at stopmovie in order to clean up temporary members used by my scripts 50 -- due to a bug in director I had to change the old behaavior of erasing the members on endsprite, when I was done with it ! 51 -- so now I use a list of temporary members, which is maintained during runtime, but must be processed when the movie is stopped 52 -- (unless you want to fill up your castlib with temporary members :-) 53 54 -- NOW: 55 -- if this script is NOT the first moviescript in your movie containing a stopmovie handler this one gets overriddden and 56 -- you must call 'mCallDestroy()' in your stopmovie handler. 57 -- otherwise when it this script comes before your script with the stopmovie handler your handler will never be called 58 -- since the stopmovie event is caught here... 59 -- in that case just comment it out here and add the 'mCallDestroy()' to your own stopmovie handler 60 61 --on stopmovie me 62 -- mCallDestroy 63 --end 1 -- commonMovieScript 2 ----------------------------------- 3 -- CREATED: 4 -- 11.02.2008 5 -- 6 -- DESCRIPTION: 7 -- Shared Global Handlers ©03 Alex da Franca -- alex@farbflash.de 8 -- ------------------------------------------------------------------- 9 -- these handlers are shared between all of my scripts Alex da Franca ©2003 alex@farbflash.de 10 -- for private use of my scripts -> poor documentation -> use at own risk ;-) 11 12 -- HISTORY: 13 -- geaendert am 21.06.03 14 -- mGetInstance 0 -- clears all stored instances -> same as recompile all scripts, but that would clear all contents of (script "commonMovieScript").pGList 15 -- mApplyDynamic 16 17 -- alex am 13.03.2004 um 13:49 18 -- added DEBUG_FUNCTIONS 19 20 -- alex am 15.03.2004 um 08:50 21 -- added mGetPlatform() to get OSX 22 -- alex am 31.03.2004 um 11:42 23 -- added clearglobals to mDestroy handler 24 25 -- added support for new director MX2004 sprite names in my handlers by changing mGetKanal() to accept strings 26 27 -- alex am Freitag, 4. Juni 2004 28 -- took care about missing font asset xtra, if it isn't present, we'll get not a script error anymore 29 -- but rather the presence of the font is not checked instead, but rather assumed 30 31 -- alex am 16. Juni 2004 um 10:12 32 -- added mGetNextLowerPowerOfTwo 33 34 -- alex am 18. Juli 2004 um 08:02 35 -- added mMyClearGlobals() to erase the faked globals and get the new globallist 36 37 -- alex am 8. Oktober 2004 um 10:31 38 -- new tempmember handling due to a bug in director 39 40 -- alex am 23. November 2004 um 10:59 41 -- added mGetThisMovieName() and mSetThisMovieName() to identify the movie independant of the filename 42 -- this is needed for some places, where the standard scripts act differently in the different movies 43 44 -- Scriptmarker (21.07.2005 at 11:55 Uhr): changes // Scriptmarker 45 -- added mSplitPath 46 47 -- 48 -- WARNINGS: 49 -- IMPORTANT NOTE !! 50 -- if you use my scripts you MUST call 'mCallDestroy()' at stopmovie in order to clean up temporary members used by my scripts 51 -- due to a bug in director I had to change the old behaavior of erasing the members on endsprite, when I was done with it ! 52 -- so now I use a list of temporary members, which is maintained during runtime, but must be processed when the movie is stopped 53 -- (unless you want to fill up your castlib with temporary members :-) 54 55 -- If this script is NOT the first moviescript in your movie containing a stopmovie handler this one gets overriddden and 56 -- you must call 'mCallDestroy()' in your stopmovie handler. 57 -- otherwise when it this script comes before your script with the stopmovie handler your handler will never be called 58 -- since the stopmovie event is caught here... 59 -- in that case just comment it out here and add the 'mCallDestroy()' to your own stopmovie handler 60 61 -- on stopmovie me 62 -- mCallDestroy 63 -- end 64 -- TODO: 65 -- - 66 ----------------------------------- 64 67 65 68 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx … … 72 75 73 76 on mGetGlobalList me 77 ----------------------------------- 78 -- ACTION: We keep a list of "faked global variables" 79 -- Using real global variables has the drawback, 80 -- that they may clash with the host movies globals 81 -- and even worse: all movie instances running in the same player 82 -- instance -> MIAWs share only one global space 83 -- Since these scripts are also used in my authoring tools 84 -- they can behave nicely, if running as miaws in any environment 85 -- INPUT: - 86 -- RETURNS: property list with global variables 87 -- NOTES: If possible only use the set and get handlers (mSetGlobalValue, mGetGlobalValue) 88 ----------------------------------- 89 74 90 if voidP(pGList) then 75 91 pGList = [:] … … 86 102 87 103 on mMyClearGlobals me 104 ----------------------------------- 105 -- CREATED: 11.02.2008 106 -- ACTION: Clear the global list at runtime (at authortime a "Recompile all scripts" does the same) 107 -- See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 108 -- INPUT: - 109 -- RETURNS: - 110 ----------------------------------- 111 88 112 pGList = [:] 89 113 return pGList … … 94 118 95 119 on mSetGlobalValue me, propName, newValue 120 ----------------------------------- 121 -- ACTION: Set the value for a "global" variable 122 -- If the "global" with the name #propname doesn't exits it gets created 123 124 -- Interface to the "private globals" stored in this uninstatiated script as property 125 -- See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 126 127 -- INPUT: propName: symbol; name of global value 128 -- newValue: any value 129 -- RETURNS: - 130 ----------------------------------- 131 96 132 g = mGetGlobalList(me) 97 133 g.setaprop(propName, newValue) … … 102 138 103 139 on mGetGlobalValue me, propName 140 ----------------------------------- 141 -- ACTION: Get the value for a "global" variable 142 -- If the "global" with the name #propname doesn't exits it returns void 143 144 -- Interface to the "private globals" stored in this uninstatiated script as property 145 -- See description for "Faked globals" at handler [#mGetGlobalList_commonMovieScript mGetGlobalList] 146 147 -- INPUT: propName: symbol; name of global value 148 -- RETURNS: - 149 ----------------------------------- 150 104 151 g = mGetGlobalList(me) 105 152 return g.getaprop(propName) … … 109 156 110 157 on mCallDestroy me 158 ----------------------------------- 159 -- CREATED: 12.02.2008 160 -- ACTION: Call to clean everything up on stopmovie 161 -- INPUT: - 162 -- RETURNS: - 163 ----------------------------------- 164 111 165 112 166 sendAllSprites(#mStopMovieWasCalled) … … 154 208 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 155 209 -- xxxxxxxxxxxxxxxxxx color( -> rgb( 156 -- fix the score data which has #color instead of #rgb when authored with D10, which fails with the older player210 -- 157 211 158 212 on Authoring_ExchangeScriptListColorsToRGBs me 213 ----------------------------------- 214 -- CREATED: 12.02.2008 215 -- ACTION: fix the score data which has #color instead of #rgb when authored with D10 216 -- which fails with the older player (AUTHORING ONLY!) 217 -- INPUT: - 218 -- RETURNS: - 219 ----------------------------------- 220 159 221 theLastFrame = the lastFrame 160 222 theLastChannel = the lastChannel … … 213 275 214 276 on mGetVersionNumber me 277 ----------------------------------- 278 -- CREATED: 12.02.2008 279 -- ACTION: Get player veersion number as float, so that proper maths can be made 280 -- INPUT: - 281 -- RETURNS: float => director player version number 282 ----------------------------------- 215 283 216 284 glob = mGetGlobalList(me) … … 251 319 252 320 on mGetPlatform me 321 ----------------------------------- 322 -- CREATED: 12.02.2008 323 -- ACTION: Get the platform as symbol 324 -- the advantage is that the result is cached in the global list 325 -- and the distinction between OS9 and OSX is made 326 -- INPUT: - 327 -- RETURNS: symbol => platform identifier; range: #os9, #osx, #win 328 ----------------------------------- 253 329 254 330 glob = mGetGlobalList(me) … … 276 352 277 353 on mCheckMemberType me, memref, aType 354 ----------------------------------- 355 -- CREATED: 12.02.2008 356 -- ACTION: Check if the member reference <memref> is of type <aType> 357 -- This handler works in D<10 and D>=10 358 -- INPUT: member reference 359 -- symbol 360 -- RETURNS: boolean (integer) 361 ----------------------------------- 362 278 363 if voidP(memref) then return 0 279 364 return (memref.type = aType) … … 283 368 284 369 on mGetMemType me, memref 370 ----------------------------------- 371 -- CREATED: 12.02.2008 372 -- ACTION: Return the type of member <memref> 373 -- This handler works in D<10 and D>=10 374 -- If memref is not a valid member this handler returns #empty, like D<10 used to 375 -- INPUT: member reference 376 -- RETURNS: symbol => member type; range: every member type and #empty 377 ----------------------------------- 285 378 if ilk(memref) <> #member then return #empty 286 379 return memref.type … … 290 383 291 384 on mCreateTimeout me, theName, theDuration, theHandler, theTarget 385 ----------------------------------- 386 -- CREATED: 12.02.2008 387 -- ACTION: Create/Get timeout object 388 -- This handler works the same with the old player <10 and the new player >=10 389 -- INPUT: ||ÊtheName || string || name for new timeout object|| 390 -- ||ÊtheDuration || integer || timeout perios in milliseconds|| 391 -- || theHandler || symbol || handler to be called on each timepout event|| 392 -- || theTarget || object || object to be sent the timeout event <theHandler>|| 393 -- RETURNS: timeout object 394 ----------------------------------- 292 395 293 396 dto = timeout(theName) … … 1392 1495 1393 1496 if delim = "\" then 1497 if length(thePath) > 1 then 1394 1498 if thePath.char[2] = ":" then 1395 1499 num = charToNum(thePath.char[1]) … … 1400 1504 praef = "" 1401 1505 end if 1506 else 1507 praef = "" 1508 end if 1402 1509 else 1403 1510 praef = ""
Note: See TracChangeset
for help on using the changeset viewer.
