Community

SCI Programming => SCI Syntax Help => Topic started by: gumby on February 15, 2011, 02:14:53 PM

Title: UnLoad (script) vs. DisposeScript
Post by: gumby on February 15, 2011, 02:14:53 PM
Is there any difference between these two commands in this context?

Code: [Select]
  UnLoad(rsSCRIPT 100)
  DisposeScript(100)

According to the Studio help file:
UnLoad - Unloads a resource from memory. If the resource is rsMEMORY, it frees the allocated memory specified by it's pointer.
DisposeLoad - Unloads a script from memory, including all it's classes, instances, variables, etc.


Just curious.

Title: Re: UnLoad (script) vs. DisposeScript
Post by: Cloudee1 on February 15, 2011, 06:41:38 PM
Somewhere if you track down the dispose script, it makes an unload call, Skip the middle man I say. i unload the resources i use in each script. i don't trust enough i guess
Title: Re: UnLoad (script) vs. DisposeScript
Post by: gumby on February 15, 2011, 09:10:57 PM
I wasn't able to find a 'Dispose' script.  Might you be thinking of the 'DisposeLoad' script?  Here is the procedure:

Code: [Select]
(procedure public (DisposeLoad rsType rsNumbers)
(var i, num)
= paramTotal (- paramTotal 2)
(for (= i 0) (<= i paramTotal) (++i)
= num rsNumbers[i]
(if(rsType)
Load(rsType num)
)(else
DisposeScript(num)
)
)
)

As a side note, I don't quite understand why we would be calling the Load() function (sometimes) if we are calling a script which I would think would be 'unloading'.  I see that in the Main.sc we call this procedure with a NULL value for rsType, so the Load() in this case never gets called...
Title: Re: UnLoad (script) vs. DisposeScript
Post by: Cloudee1 on February 16, 2011, 04:56:41 PM
Yeah I'm pretty sure there is a template bug fix post, maybe somewhere else, mines had an unload there for years, forgot it said load... and yeah thats the script I was talking about.

* apparantly that was way back in the Mega-Tokyo days... not seeing it anywhere now.
Title: Re: UnLoad (script) vs. DisposeScript
Post by: gumby on February 16, 2011, 09:26:28 PM
So why the difference in the releasing of resources (Unload vs. DisposeScript)?  That would seem to suggest that you 'Unload' some resources, like pics & texts.  But when it comes to a script, one should unload via DisposeScript?  Perhaps to ensure all the variables, etc. get removed as suggested in the Studio help file?  Worth some more investigation, I suppose. 
Title: Re: UnLoad (script) vs. DisposeScript
Post by: Cloudee1 on February 17, 2011, 11:38:51 AM
There's also a FlushResources...  I use UnLoad exclusively, maybe it was the only one I got measurable results from, or it's the only one I got to run without errors, can't remember now.