<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://sciwiki.sierrahelp.com/index.php?action=history&amp;feed=atom&amp;title=Dispose_All_Scripts</id>
	<title>Dispose All Scripts - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://sciwiki.sierrahelp.com/index.php?action=history&amp;feed=atom&amp;title=Dispose_All_Scripts"/>
	<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Dispose_All_Scripts&amp;action=history"/>
	<updated>2026-11-28T21:03:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Dispose_All_Scripts&amp;diff=6997&amp;oldid=prev</id>
		<title>Andrew Branscom at 00:59, 31 October 2013</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Dispose_All_Scripts&amp;diff=6997&amp;oldid=prev"/>
		<updated>2013-10-31T00:59:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:59, 31 October 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Originally posted on the [[scipf:&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;SCI Programming Forum&lt;/del&gt;|SCI Programming Forum]] by [[Gumby]].&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Originally posted on the [[scipf:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;topic,709.html&lt;/ins&gt;|SCI Programming Forum]] by [[Gumby]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Disposing of as many scripts as possible can help preserve heap space. I had to exclude a couple to keep the game running correctly.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Disposing of as many scripts as possible can help preserve heap space. I had to exclude a couple to keep the game running correctly.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key collectr_mwSCI-mw_:diff::1.12:old-6984:rev-6997 --&gt;
&lt;/table&gt;</summary>
		<author><name>Andrew Branscom</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Dispose_All_Scripts&amp;diff=6984&amp;oldid=prev</id>
		<title>Andrew Branscom: Created page with &quot;Originally posted on the SCI Programming Forum by Gumby.  Disposing of as many scripts as possible can help preserve heap space. I had to e...&quot;</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Dispose_All_Scripts&amp;diff=6984&amp;oldid=prev"/>
		<updated>2013-10-30T23:44:23Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Originally posted on the &lt;a href=&quot;https://sciprogramming.com/community/index.php?SCI_Programming_Forum&quot; class=&quot;extiw&quot; title=&quot;scipf:SCI Programming Forum&quot;&gt;SCI Programming Forum&lt;/a&gt; by &lt;a href=&quot;/index.php/Gumby&quot; class=&quot;mw-redirect&quot; title=&quot;Gumby&quot;&gt;Gumby&lt;/a&gt;.  Disposing of as many scripts as possible can help preserve heap space. I had to e...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Originally posted on the [[scipf:SCI Programming Forum|SCI Programming Forum]] by [[Gumby]].&lt;br /&gt;
&lt;br /&gt;
Disposing of as many scripts as possible can help preserve heap space. I had to exclude a couple to keep the game running correctly.&lt;br /&gt;
&lt;br /&gt;
Here is a really small script that will do the task.  As far as I know, this can be called safely at any time within a room script.  I use it in [[Zork]] when I&amp;#039;ve loaded up a ton of scripts and have no idea what to unload and I&amp;#039;m out of heap space.&lt;br /&gt;
&lt;br /&gt;
It won&amp;#039;t unload Main.sc, Controls.sc, itself, and the current room script and any script number above 988.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
/******************************************************************************&lt;br /&gt;
 DisposeScripts.sc&lt;br /&gt;
 Unloads all scripts (with exceptions)&lt;br /&gt;
 &lt;br /&gt;
 ******************************************************************************/&lt;br /&gt;
(include &amp;quot;sci.sh&amp;quot;)&lt;br /&gt;
(include &amp;quot;game.sh&amp;quot;)&lt;br /&gt;
/******************************************************************************/&lt;br /&gt;
(script DISPOSESCRIPTS_SCRIPT)&lt;br /&gt;
&lt;br /&gt;
(use &amp;quot;main&amp;quot;)&lt;br /&gt;
/******************************************************************************/&lt;br /&gt;
(procedure public (DisposeScripts) &lt;br /&gt;
  (var i)&lt;br /&gt;
&lt;br /&gt;
  (for (= i 1) (&amp;lt; i 989) (++i)   // start at 1, excludes Main.sc&lt;br /&gt;
    (if (&amp;lt;&amp;gt; i gRoomNumber and &amp;lt;&amp;gt; i DISPOSESCRIPTS_SCRIPT and &amp;lt;&amp;gt; i CONTROLS_SCRIPT)&lt;br /&gt;
       DisposeScript(i)&lt;br /&gt;
    )&lt;br /&gt;
  )&lt;br /&gt;
)&lt;br /&gt;
/******************************************************************************/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally, this code could possibly replace this section of code in Main.sc:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
	(method (startRoom roomNum)&lt;br /&gt;
		DisposeLoad(&lt;br /&gt;
			NULL&lt;br /&gt;
			FILEIO_SCRIPT JUMP_SCRIPT EXTRA_SCRIPT WINDOW_SCRIPT&lt;br /&gt;
		        TIMER_SCRIPT FOLLOW_SCRIPT REV_SCRIPT DCICON_SCRIPT&lt;br /&gt;
		        DOOR_SCRIPT AUTODOOR_SCRIPT WANDER_SCRIPT AVOID_SCRIPT&lt;br /&gt;
		)&lt;br /&gt;
		DisposeScript(DISPOSELOAD_SCRIPT)&lt;br /&gt;
         ...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
	(method (startRoom roomNum)&lt;br /&gt;
		DisposeScripts()&lt;br /&gt;
                DisposeScript(DISPOSESCRIPTS_SCRIPT)&lt;br /&gt;
         ...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Memory Management]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:Examples]]&lt;br /&gt;
[[Category:Memory]]&lt;/div&gt;</summary>
		<author><name>Andrew Branscom</name></author>
	</entry>
</feed>