<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://sciwiki.sierrahelp.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Omer+Mor</id>
	<title>SCI Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://sciwiki.sierrahelp.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Omer+Mor"/>
	<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php/Special:Contributions/Omer_Mor"/>
	<updated>2026-09-10T21:52:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13689</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13689"/>
		<updated>2018-04-15T19:25:27Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method is one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code in the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#Overlay Modules|1.4 Overlay Modules]] and [[#Pre-loading Resources (Optimization)|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may be positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an &amp;#039;&amp;#039;else&amp;#039;&amp;#039; clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approachVerbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(= x       17)&lt;br /&gt;
(= foobar  29)&lt;br /&gt;
(x      doit:   y z)&lt;br /&gt;
(foobar rescind: TRUE)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13688</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13688"/>
		<updated>2018-04-15T19:07:15Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Setting Up the Cast */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method is one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code in the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#Overlay Modules|1.4 Overlay Modules]] and [[#Pre-loading Resources (Optimization)|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may be positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an &amp;#039;&amp;#039;else&amp;#039;&amp;#039; clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approachVerbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13687</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13687"/>
		<updated>2018-04-15T19:05:49Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Initial Code Based on Previous Room */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method is one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code in the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#Overlay Modules|1.4 Overlay Modules]] and [[#Pre-loading Resources (Optimization)|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may be positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an &amp;#039;&amp;#039;else&amp;#039;&amp;#039; clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13686</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13686"/>
		<updated>2018-04-15T19:04:12Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Setting Up Ego */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method is one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code in the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#Overlay Modules|1.4 Overlay Modules]] and [[#Pre-loading Resources (Optimization)|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may be positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13685</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13685"/>
		<updated>2018-04-15T19:02:43Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Pre-loading Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method is one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code in the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#Overlay Modules|1.4 Overlay Modules]] and [[#Pre-loading Resources (Optimization)|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13684</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13684"/>
		<updated>2018-04-15T19:02:12Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Pre-loading Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method is one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code in the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#OverlayModules|1.4 Overlay Modules]] and [[#Pre-loading Resources (Optimization)|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13683</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13683"/>
		<updated>2018-04-15T18:59:36Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Pre-loading Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method is one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code in the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#1.4 Overlay Modules|1.4 Overlay Modules]] and [[#3.2 Pre-loading Resources|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13682</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13682"/>
		<updated>2018-04-15T18:58:13Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Room Init */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method is one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code in the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the: top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#1.4 Overlay Modules|1.4 Overlay Modules]] and [[#3.2 Pre-loading Resources|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13681</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13681"/>
		<updated>2018-04-15T18:50:30Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Overlay Modules */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the room is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method ill one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code is the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the: cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the: top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#1.4 Overlay Modules|1.4 Overlay Modules]] and [[#3.2 Pre-loading Resources|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13680</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13680"/>
		<updated>2018-04-15T18:41:06Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Public Entries &amp;amp; Externals */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;If you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance myActor of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the mom is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method ill one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code is the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the: cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the: top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#1.4 Overlay Modules|1.4 Overlay Modules]] and [[#3.2 Pre-loading Resources|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13679</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13679"/>
		<updated>2018-04-15T18:31:33Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Procedures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;1f you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN 08JECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the mom is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method ill one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code is the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the: cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the: top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#1.4 Overlay Modules|1.4 Overlay Modules]] and [[#3.2 Pre-loading Resources|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13678</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13678"/>
		<updated>2018-04-15T18:29:50Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  The Order or Things */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a-procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;1f you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN 08JECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the mom is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method ill one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code is the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the: cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the: top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#1.4 Overlay Modules|1.4 Overlay Modules]] and [[#3.2 Pre-loading Resources|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13677</id>
		<title>Laura Bow II Programming Style Manual</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Laura_Bow_II_Programming_Style_Manual&amp;diff=13677"/>
		<updated>2018-04-15T18:28:30Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Module Organization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Official SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Laura Bow II Programming Style Manual&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot; style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Coding Preference Of [[Brian K. Hughes]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is an attempt at a programming style manual. It is intended to provide the reader with a list of my coding styles, and the DOs and DON&amp;#039;Ts of coding on [[Dagger of Amon Ra|Laura Bow II]]. &amp;#039;&amp;#039;It is not intended to be an authorized representation of Sierra coding policies&amp;#039;&amp;#039;. While many of the rules listed in this document are no more than the personal preferences of a demented lead programmer (yours truly), I hope that the majority of this material will become ingrained in your programmer-self and carried on to your next project. Obviously, I&amp;#039;d like to see everyone adopt my coding style, but I am not the only lead programmer here. Just as I like things my way, so another lead may like it differently. The best we can hope: for, therefore, is a union of styles; if we all code alike, it really doesn&amp;#039;t matter if it&amp;#039;s my way or someone else&amp;#039;s.&lt;br /&gt;
&lt;br /&gt;
Please keep in mind that the information in this document is not carved in stone (but only because my printer has trouble feeding slabs of granite). If you have a serious objection to a concept herein, or feel you have a more efficient way to achieve the desired result, feel free to contact me. I firmly believe that one who is in a teaching capacity must spend roughly half his time learning as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- &lt;br /&gt;
==&amp;lt;br /&amp;gt; Contents ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;80&amp;quot;|1.0 ||width=&amp;quot;300&amp;quot;|Module Organization ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|l.l ||The Order of Things ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.2 ||Procedures ||page 3&lt;br /&gt;
|-&lt;br /&gt;
|1.3 ||Public Entries &amp;amp; Externals ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|1.4 ||Overlay Modules ||page 4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 ||Object Organization ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1 ||Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 5&lt;br /&gt;
|-&lt;br /&gt;
|2.1.1 ||Pre-loading Resources ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.2 ||Setting the Region ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.3 ||Setting Up Ego ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.4 ||Initial Code Based on Previous Room ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.5 ||Super &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.6 ||Setting Up Polygons ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.7 ||Setting Up the Cast ||page 6&lt;br /&gt;
|-&lt;br /&gt;
|2.1.8 ||Selling Up Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.9 ||Miscellaneous Initial Code ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.1.10 ||Setting Script(s) ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.2 ||Dynamic Objects ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.3 ||A Word About Features ||page 7&lt;br /&gt;
|-&lt;br /&gt;
|2.4 ||Annotation ||page 8&lt;br /&gt;
|-&lt;br /&gt;
|3.0 ||Optimization ||page 9&lt;br /&gt;
|-&lt;br /&gt;
|3.1 ||The Dreaded Doit ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.2 ||Pre-Loading Resources ||page 10&lt;br /&gt;
|-&lt;br /&gt;
|3.3 ||Messaging ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.0 ||Indention ||page 11&lt;br /&gt;
|-&lt;br /&gt;
|4.1 ||Tabs vs. Spaces ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.2 ||In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.3 ||In Properties Lists ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.4 ||In Complex Messages ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.5 ||In Arrays ||page 12&lt;br /&gt;
|-&lt;br /&gt;
|4.6 ||Blank Line ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|4.7 ||Examples ||page 13&lt;br /&gt;
|-&lt;br /&gt;
|5.0 ||Naming Conventions ||page 14&lt;br /&gt;
|-&lt;br /&gt;
|6.0 ||The Part at the End ||page 14&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 1.0 --&amp;gt;Module Organization ==&lt;br /&gt;
&lt;br /&gt;
Arranging the elements of your module in a particular order makes the code much easier to read and maintain by others. Generally, grouping object by type is the easiest, although sometimes it is more logical to group objects by subject. For example, an actor could be grouped with all the other actors, or with his mover, sound, and script. Either way is acceptable.&lt;br /&gt;
&lt;br /&gt;
Clearly mark your groups so that they can be found easily. A distinguishable comment before a group of items is the easiest way to do this. I have a macro, called [[MakeBox]], which will create a double-lined box around a piece of text. I will be happy to provide this macro to anyone who wants to adopt its style.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.1 --&amp;gt;The Order or Things ===&lt;br /&gt;
&lt;br /&gt;
The following chart represents how I like to organize a file. You need not adhere to it strictly, but I strongly recommend it. Items marked with a § are required for every module.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
header comments&amp;lt;ref&amp;gt;Header comments should include the name and purpose of the module, the author, the date last Updated, and a list of any classes defined in the module.&amp;lt;/ref&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Script #&amp;lt;br /&amp;gt;&lt;br /&gt;
includes&amp;lt;br /&amp;gt;&lt;br /&gt;
procedure list&amp;lt;br /&amp;gt;&lt;br /&gt;
public entry list&amp;lt;br /&amp;gt;&lt;br /&gt;
defines&amp;lt;br /&amp;gt;&lt;br /&gt;
locals&amp;lt;br /&amp;gt;&lt;br /&gt;
instance of LBRoom&amp;lt;br /&amp;gt;&lt;br /&gt;
procedures&amp;lt;br /&amp;gt;&lt;br /&gt;
scripts&amp;lt;br /&amp;gt;&lt;br /&gt;
Actors &amp;amp; Props&amp;lt;br /&amp;gt;&lt;br /&gt;
Talkers &amp;amp; related objects&amp;lt;br /&amp;gt;&lt;br /&gt;
View &amp;amp; PicViews&amp;lt;br /&amp;gt;&lt;br /&gt;
Features&amp;lt;br /&amp;gt;&lt;br /&gt;
Sound, Code, &amp;amp; Misc&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.2 --&amp;gt;Procedures ===&lt;br /&gt;
&lt;br /&gt;
In the above list, you&amp;#039;ll, notice that I recommend procedures do not come before the instance of room. The rationale behind this is that that main object in the module (the room instance in room modules) should be the first code encountered. Some modules may contain several long procedures. It is inconvenient to one perusing the file to have to page-up and page-down through these procedures to see what the main object looks like.&lt;br /&gt;
&lt;br /&gt;
Be aware of your coworkers&amp;#039; procedures. If there is a-procedure already written that may be used again with little or no modification, it may be beneficial to break the procedure out of the module in which it resides, put it into room 0 or other public module, and create an external reference define for it in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
(? Is room0 public ? )&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.3 --&amp;gt;Public Entries &amp;amp; Externals ===&lt;br /&gt;
&lt;br /&gt;
Any object that will be referenced outside the module in which it resides must be assigned a public entry number in that module. As an example, an instance of room in a room module must be assigned public entry number 0. This is how &amp;#039;&amp;#039;Game startRoom&amp;#039;&amp;#039; knows about the room&amp;lt;ref&amp;gt;1f you are receiving a &amp;#039;&amp;#039;&amp;#039;NOT AN 08JECT: $0&amp;#039;&amp;#039;&amp;#039; error when Game startRoom tries to add your room to the regions list, check to see if you&amp;#039;ve forgotten the public entry for your instance of LBRoom.&amp;lt;/ref&amp;gt;. Public objects are referenced in other modules via the &amp;#039;&amp;#039;[[ScriptID()|ScriptID]]&amp;#039;&amp;#039; kernel call. &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; takes as parameters the number of the module in which our public object resides and the public entry number assigned to it, and returns an address to that object. For example, given:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(script# 100)&lt;br /&gt;
&lt;br /&gt;
(public&lt;br /&gt;
         myActor0&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
(instance &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; of Actor)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can reference &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; from another module with &amp;#039;&amp;#039;(ScriptID 100 0)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
If you will be referencing an object more than once, you should create a define for the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; call. In the above example, we could save the object ID of &amp;#039;&amp;#039;myActor&amp;#039;&amp;#039; for use in several places, by creating the following define:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(define xMyActor&amp;lt;ref&amp;gt;Refer to section &lt;br /&gt;
[[#5.4 Defines. Globals. Flags. &amp;amp; Vars|5.4 Defines. Globals. Flags. &amp;amp; Vars]] for more information on this syntax.&amp;lt;/ref&amp;gt; (ScriptID 100 0))&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Procedures may be referenced externally as well as objects. The process is the same for objects and procedures, but our procedures will be referenced through extern statements in &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;. These work the same as the &amp;#039;&amp;#039;ScriptID&amp;#039;&amp;#039; statement above, but generate a different PMachine op code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 1.4 --&amp;gt;Overlay Modules ===&lt;br /&gt;
&lt;br /&gt;
Overlay modules are modules that contain objects related to, but not always necessary for, a room module. You should review the code situation very carefully before splitting code out into an overlay module. Overlays are often difficult to manage, and can be very tricky as far as memory management. By contrast, however, they are not as difficult to create as they seem. Overlays should be considered if:&lt;br /&gt;
&lt;br /&gt;
*§ The total size of the source module is approaching 64K&lt;br /&gt;
*§ There is a group of objects or large amount of code that is used only in a specific situation&lt;br /&gt;
*§ The amount of hunk available when running the mom is less than 5K&lt;br /&gt;
*§ There is a group of objects or large amount of code that can be shared by other modules&amp;lt;br /&amp;gt;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Creating an overlay module is a relatively simple process. Refining it, however, may take some time and will most certainly break the original module temporarily. To create an overlay module, do the following:&lt;br /&gt;
&lt;br /&gt;
*§ Create a new file with an appropriate name&lt;br /&gt;
*§ Move the code to be split out into the new module&lt;br /&gt;
*§ Create public entries in the original module for objects that must be referenced in the overlay&lt;br /&gt;
*§ Create external reference defines in the overlay to point to the public entries in the original module&lt;br /&gt;
*§ Crete public entries in the overlay for objects that must be referenced in the original module&lt;br /&gt;
*§ Create external reference defines in the original module to point to the public entries in the overlay&lt;br /&gt;
*§ Be sure that either the original module or the overlay itself removes the overlay from memory when finished with it&lt;br /&gt;
&lt;br /&gt;
The hardest part about creating overlay modules is getting the external referencing correct. &amp;#039;&amp;#039;&amp;#039;NOT AN OBJECT&amp;#039;&amp;#039;&amp;#039; will generally mean that one of the two modules is trying to send a message to an object that is no longer in that module. &amp;#039;&amp;#039;&amp;#039;DISPATCH NUMBER TOO LARGE&amp;#039;&amp;#039;&amp;#039; generally is caused by trying to reference a public entry that is larger than the last public entry for that module. For example, the error will occur if (ScriptID 100 3) is used in one module and script# 100 only contains public entries 0, 1, and 2.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 2.0 --&amp;gt;Object Organization ==&lt;br /&gt;
&lt;br /&gt;
How you layout your objects&amp;#039; code is nearly as important as how you layout the module, in terms of style. For most objects, this section is not important. But for a few objects such as rooms, these guidelines are recommended.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1 --&amp;gt;Room &amp;#039;&amp;#039;Init&amp;#039;&amp;#039; ===&lt;br /&gt;
The &amp;#039;&amp;#039;room&amp;#039;&amp;#039; is one of the most common objects in the game, and the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method ill one of the most frequently referenced. It is fairly important, therefore, to keep the room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method clean and easily readable. One way in which this can be accomplished is to order your room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; code is the following way:&lt;br /&gt;
&lt;br /&gt;
# Pre-loading Resources&lt;br /&gt;
# Setting the region, if any&lt;br /&gt;
# Setting up ego&amp;lt;ref&amp;gt;Ego must generally be inited before the &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039;, if the room is an instance of a subclass of Room that handles walking ego in and out of rooms.&amp;lt;/ref&amp;gt;&lt;br /&gt;
# Initial code based on previous room&lt;br /&gt;
# &amp;#039;&amp;#039;Super init:&amp;#039;&amp;#039;&lt;br /&gt;
# Setting up Polygons&lt;br /&gt;
# Setting up the: cast&lt;br /&gt;
# Setting up features&lt;br /&gt;
# Miscellaneous initial code&lt;br /&gt;
# Setting script(s)&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.1 --&amp;gt;Pre-loading Resources ====&lt;br /&gt;
&lt;br /&gt;
All views, pics, sounds, cursors, and fonts used in the module should be loaded here. This serves two purposes: 1) to annotate which resources are being used (better than comments at the: top of the file), and 2) to prevent &amp;quot;disk hits&amp;quot; during the execution of a room, the theory being that if all the resources are loaded the game should never require disk access until another room change.&amp;lt;ref&amp;gt;If all resources have been pre-loaded and disk access is still occurring, this may indicate that the room is &amp;quot;hunk heavy&amp;quot; and prone to thrashing. See also sections [[#1.4 Overlay Modules|1.4 Overlay Modules]] and [[#3.2 Pre-loading Resources|3.2 Pre-loading Resources]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.2 --&amp;gt;Setting the Region ====&lt;br /&gt;
&lt;br /&gt;
Setting the room to a region (or vice versa, depending upon how you choose to look at it) is accomplished with the &amp;#039;&amp;#039;(self setRegions: regionModuleNum)&amp;#039;&amp;#039; statement, where &amp;#039;&amp;#039;regionModuleNum&amp;#039;&amp;#039; will usually be a define from &amp;#039;&amp;#039;&amp;#039;[[GAME.SH]]&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.3 --&amp;gt;Setting Up Ego ====&lt;br /&gt;
&lt;br /&gt;
Setting up ego will normally consist of two messages, an &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and a &amp;#039;&amp;#039;normalize&amp;#039;&amp;#039;. Additionally, ego may positioned here or have alternate cyclers and movers set. Note that the game&amp;#039;s &amp;#039;&amp;#039;startRoom&amp;#039;&amp;#039; method will put a StopWalk cycler on ego by default. Except in extreme cases, you should not alter ego&amp;#039;s &amp;#039;&amp;#039;edgeHit&amp;#039;&amp;#039; property here.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.4 --&amp;gt;Initial Code Based on Previous Room ====&lt;br /&gt;
&lt;br /&gt;
Any initial code based on the previous room, such as positioning ego or setting vars, is accomplished by the &amp;#039;&amp;#039;(switch prevRoomNum)&amp;#039;&amp;#039; statement, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(switch prevRoomNum&lt;br /&gt;
         (north&lt;br /&gt;
                [code if coming from the north]&lt;br /&gt;
         )&lt;br /&gt;
         (south&lt;br /&gt;
                [code if coming from the south]&lt;br /&gt;
         )&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is helpful to include an else clause that sets debugging information when teleporting.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.5 --&amp;gt;Super Init: ====&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;(super init:)&amp;#039;&amp;#039; statement causes the super class, Room or a subclass thereof, to perform its initialization code. Among other things, this code draws the picture and sets ego to walk into the room (if appropriate).&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.6 --&amp;gt;Setting Up Polygons ====&lt;br /&gt;
&lt;br /&gt;
This is where polygons should be added to the room&amp;#039;s obstacles list. They may be created dynamically (the normal output from the polygon editor) or be static instances that are simply added to the list.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.7 --&amp;gt;Setting Up the Cast ====&lt;br /&gt;
&lt;br /&gt;
This is where all the Actors, Props, Views, and PicViews are initialized. From a size standpoint, it is cheaper to send complex messages here than to override the object&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(object init:, approach Verbs: verbList)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.8 --&amp;gt;Setting Up Features ====&lt;br /&gt;
&lt;br /&gt;
Features should all be initialized in one place to make locating them later easier. Features should he initialized individually, just like other objects&amp;lt;ref&amp;gt;For more information on features see also section [[#2.3 A Word About Features|2.3 A Word About Features]].&amp;lt;/ref&amp;gt;. As with objects in the cast, it is better to have complex messages here than in the Feature&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.9 --&amp;gt;Miscellaneous Initial Code ====&lt;br /&gt;
&lt;br /&gt;
This is where other initialization code should go. I strongly suggest annotating this code well to make it as clear as possible.&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;br /&amp;gt; &amp;lt;!-- 2.1.10 --&amp;gt;Setting Script(s) ====&lt;br /&gt;
&lt;br /&gt;
Finally, the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of a room should set any scripts that need to be executed upon entering a room. Sometimes another &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; is required to set different scripts based on the previous room.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.2 --&amp;gt;Dynamic Objects ===&lt;br /&gt;
&lt;br /&gt;
A dynamic object is a clone of an object, an exact duplicate. They are useful when you need &amp;#039;&amp;#039;an&amp;#039;&amp;#039; object, but don&amp;#039;t care &amp;#039;&amp;#039;which&amp;#039;&amp;#039; object. For example, you might need a temporary list to hold numbers for a sort routine. A dynamic list can be used just like any instance of List, but does not require an instance in the module. In the debugger&amp;#039;s object list, a dynamic object will be preceded by an asterisk and will bear the same name as the object from which it was cloned. There are two ways to create a dynamic object: &amp;#039;&amp;#039;(theObj new:)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;(Clone theObj)&amp;#039;&amp;#039;. Whenever possible, the new method should be used instead of the kernel call.&lt;br /&gt;
&lt;br /&gt;
Because dynamic objects allocate space off the heap instead of hunk, it is important to set a variable to the object&amp;#039;s address so that it may be disposed of later. Orphaned dynamic objects (those left &amp;quot;hanging&amp;quot; with no handle to them) can cause frags or heap problems. By the same token, the number of dynamic objects in memory at one time should be monitored carefully. Too many objects can lead to low heap problems.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.3 --&amp;gt;A Word About Features ===&lt;br /&gt;
&lt;br /&gt;
The notion that it is more efficient to add all the features to the features list and then in it them all is incorrect. Since the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method of Feature adds the object to the feature list, it is redundant to add it manually before the init. For example:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|valign=&amp;quot;top&amp;quot; width=&amp;quot;50&amp;quot;|Replace||&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(features&lt;br /&gt;
   add:&lt;br /&gt;
     object1 &lt;br /&gt;
     object2&lt;br /&gt;
     object3,&lt;br /&gt;
   eachElementDo: #init&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;||valign=&amp;quot;top&amp;quot;|with||valign=&amp;quot;top&amp;quot;|&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;(object1 init:)&lt;br /&gt;
(object2 init:)&lt;br /&gt;
(object3 init:)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Features created with the on-line feature writer will have simple nsRects that define the area for which the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method will return TRUE, thus claiming an event. This &amp;quot;claim area&amp;quot; can be redefined by:&lt;br /&gt;
&lt;br /&gt;
*§ redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; signal bit &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color &lt;br /&gt;
*§ setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to an instance of polygon &lt;br /&gt;
&lt;br /&gt;
Redefining the &amp;#039;&amp;#039;onMe&amp;#039;&amp;#039; method is by far the most versatile, though often not the most convenient. Setting the &amp;#039;&amp;#039;[[SKIPCHECK]]&amp;#039;&amp;#039; bit in the signal property is very easy and requires no changes to the view or the code. Setting the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property to a control color is also very easy, but requires a change to the picture. Of the three, I recommend using &amp;#039;&amp;#039;SKIPCHECK&amp;#039;&amp;#039; wherever possible.&lt;br /&gt;
&lt;br /&gt;
This brings us to dynamic polygons in features. Creating a dynamic polygon in the features &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, then putting its object ID into the &amp;#039;&amp;#039;onMeCheck&amp;#039;&amp;#039; property is inefficient at best and dangerous at worst. Not only does this method require redefining the &amp;#039;&amp;#039;init&amp;#039;&amp;#039; and &amp;#039;&amp;#039;dispose&amp;#039;&amp;#039; methods to create and dispose the polygon, but each dynamic polygon created will allocate approximately 300 bytes off the heap. In a room with 25 such features, up to 7,500 bytes of heap could be allocated by dynamic polygons. In addition, should you forget to dispose of the polygon in the feature&amp;#039;s dispose method, the resulting frag can be very difficult and time-consuming to trace. I strongly advise against this method of defining features.&lt;br /&gt;
&lt;br /&gt;
A word about addToPics: Whenever the &amp;#039;&amp;#039;[[addToPic()|addToPic]]&amp;#039;&amp;#039; method of a [[VIEW|View]], [[Prop Class|Prop]], or [[Actor Class|Actor]] is invoked, two things happen. First, a &amp;#039;&amp;#039;[[PicView Class|PicView]]&amp;#039;&amp;#039; clone is created and added to the &amp;#039;&amp;#039;addToPics&amp;#039;&amp;#039; list. It will have all the properties of the original object, but will be named &amp;quot;&amp;#039;&amp;#039;PicView&amp;#039;&amp;#039;&amp;quot;. Second, the original object will be removed from the cast and added to the features list. This is NOT a dynamic object, but the original object itself.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 2.4 --&amp;gt;Annotation ===&lt;br /&gt;
&lt;br /&gt;
When faced with the decision of throwing something away, my father used this rule of thumb: If he hadn&amp;#039;t used it in the last year, he figured he&amp;#039;d never use it again and it got tossed. The same rule of thumb applies to commented code. Lines of code are usually commented because:&lt;br /&gt;
&lt;br /&gt;
*§ they aren&amp;#039;t needed any more&lt;br /&gt;
*§ they have been temporarily replaced by new code&lt;br /&gt;
*§ they have been permanently replaced by new code&lt;br /&gt;
*§ they have been temporarily removed for testing&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your commented code falls into any of the first three categories and you have not re-instated it within two to three days, remove it. Old commented code is a waste of space and makes reading the uncommented code more difficult.&lt;br /&gt;
&lt;br /&gt;
When dealing with objects, there are two areas in particular where I like to see comments. The first is immediately following a method declaration, unless the function is obvious, and the second is following each new method and property declared in a class. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj of Prop&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ; I like to see comments here unless the code&lt;br /&gt;
                 ; in this method is really obvious&lt;br /&gt;
         )&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
 (class myClass kindof Prop&lt;br /&gt;
          (properties&lt;br /&gt;
                    fooBar ; Explain what this property does!&lt;br /&gt;
          )&lt;br /&gt;
          (methods&lt;br /&gt;
                  setFooBar  ; Explain what this method does! &lt;br /&gt;
          ) &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Additionally, I have found that it is helpful to comment the closing paren of a method or object, especially if the code is more than 30 or 40 lines. When scrolling through a file it helps to be able to identify the object that immediately precedes the code I&amp;#039;m reading. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(instance myObj ofProp&lt;br /&gt;
         (method (init)&lt;br /&gt;
&lt;br /&gt;
         ) ;Don&amp;#039;t need a comment here&lt;br /&gt;
         (method (doit)&lt;br /&gt;
                 ... 50 lines ...&lt;br /&gt;
         ) ;end doit  &amp;lt; -Nice to have this!&lt;br /&gt;
) ;end myObj          &amp;lt; -Nice to have this, too!&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general rule is: If you can set: both the method declaration and closing paren without touching the arrow keys or Page Up or Page Down, a comment is unnecessary.&lt;br /&gt;
&lt;br /&gt;
Most people have customized their comment macros to insert special characters after the semicolon. For instance, your comments might look like this: ;§§. Some people use their initials, as in: &amp;#039;&amp;#039;&amp;#039;;SRC&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;;BH&amp;#039;&amp;#039;&amp;#039;. These are helpful in determining who has changed code.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 3.0 --&amp;gt;Optimization ==&lt;br /&gt;
&lt;br /&gt;
We are pushing toward single-platform development, which means that once the game is shipping on the IBM platform, we would like to e able to roll it over to the Macintosh and Amiga with no significant changes to code or other resources. Granted, this will require many changes to our existing system and tools. But even when the all else has been done to that effect, the single largest responsibility lies with us, the lowly application&amp;#039; programmers: Optimization. It won&amp;#039;t do us any good to be able to roll a game over to the 4.77 MHz Amiga in 2.6 hours flat, if it runs like a slug when it&amp;#039;s there.&lt;br /&gt;
&lt;br /&gt;
We have to take the responsibility &amp;lt;u&amp;gt;at the lime the code is designed and written&amp;lt;/u&amp;gt; to ensure that it will run as efficiently as possible on even the slowest machines. That does not mean, however, that we have to sacrifice animation to the point where the game becomes a slide show on a fire-breathing 386 or 486 machine. There ill a happy medium, which is well-designed and well-written code that respects machine performance variations.&lt;br /&gt;
&lt;br /&gt;
The worst offenders, in terms of speed and efficiency, are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
*§ &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; methods with code that need not be done every cycle&lt;br /&gt;
*§ sending messages each time information is needed instead of setting a variable the first time and using it in subsequent code&lt;br /&gt;
*§ not making certain animating objects are stop-updated or even added to pic when possible&lt;br /&gt;
*§ not implementing detail level &lt;br /&gt;
*§ not preloading resources &lt;br /&gt;
*§ bad overlay module management &lt;br /&gt;
*§ inefficient code layout and lack of encapsulation &lt;br /&gt;
*§ &amp;quot;Band-Aids&amp;quot;, &amp;quot;quick fixes&amp;quot;, &amp;quot;patches&amp;quot;, &amp;quot;prophylactic code&amp;quot;&amp;lt;/blockquote&amp;gt; &lt;br /&gt;
&lt;br /&gt;
If you have any questions about the best way to accomplish a task, ask me. If I don&amp;#039;t know I&amp;#039;ll be happy to find out.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.1 --&amp;gt;The Dreaded Doit ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Doit&amp;#039;&amp;#039; methods are really neat. Every game cycle each object that has a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method gels a shot at stardom. Imagine that each object with a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method is a lead programmer and that one game cycle is one project status meeting. The more material each one has to report and the more inefficiently he presents his report, the more time will be required to get around to everyone and the longer the lead meeting will take. Now imagine that Ken Williams has mandated that the project status meeting will take no more than 30 minutes. To fit within this time constraint each lead has to report only the material necessary in a clear, concise manner. Likewise, each &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method needs to contain only the code necessary and in a clear, concise syntax.&lt;br /&gt;
&lt;br /&gt;
Every message sent takes lime to execute and 16 bytes of compiled object code. Therefore, every message you can avoid in a doit is that much less overhead. If you will be checking an object&amp;#039;s property or the return value from an object&amp;#039;s method repeatedly, set a variable the first time, then use it for all subsequent checks.&lt;br /&gt;
&lt;br /&gt;
Most of all, remember that objects have minds of their own; they have properties to remember data and methods to facilitate actions and reactions. They don&amp;#039;t need to be babysat by a &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; method. For instance, in the following &amp;#039;&amp;#039;doit&amp;#039;&amp;#039; code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= = (theMusic prevSignal?) -l)&lt;br /&gt;
        (theScript cue:)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
a message is sent to &amp;#039;&amp;#039;theMusic&amp;#039;&amp;#039; and a comparison is done each and every game cycle. This sort of code should be replaced by the following lines, where the music is first played:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(theMusic play: theScript)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.2 --&amp;gt;Pre-loading Resources (Optimization) ===&lt;br /&gt;
&lt;br /&gt;
Every time the interpreter needs a view, picture, sound, cursor, font, or script that is not in memory, it has to go searching on the disk. Even on a fast hard drive this can cause pauses in the animation that can ruin the continuity of a scene. These &amp;quot;disk hits&amp;quot; can be avoided by simply pre-loading every resource the room will use, before it tries to use them. As explained in section 2.1, these pre-loads should be done at the very beginning of a room&amp;#039;s &amp;#039;&amp;#039;init&amp;#039;&amp;#039; method, using the following statement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;#039;&amp;#039;(Load resourceType resourceNumber resourceNumber...)&amp;#039;&amp;#039;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;#039;&amp;#039;[[resourceType]]&amp;#039;&amp;#039; is one of the resource type definitions in &amp;#039;&amp;#039;&amp;#039;[[SYSTEM.SH]]&amp;#039;&amp;#039;&amp;#039;. Following the resource type is a list of all the resources of that type you wish to load, as in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(Load VIEW&lt;br /&gt;
        vEgoDying&lt;br /&gt;
        vEgoLaughing&lt;br /&gt;
)&lt;br /&gt;
(Load CURSOR&lt;br /&gt;
       exitCursor&lt;br /&gt;
       walkCursor&lt;br /&gt;
)&lt;br /&gt;
(Load SCRIPT ABOUTCODE)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;#039;&amp;#039;&amp;#039;-c&amp;#039;&amp;#039;&amp;#039; option when running the interpreter to help you find disk hits in your room. This option will cause the cursor to change to a disk drive icon whenever a resource is loaded. No disk cursor means no disk hits.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 3.3 --&amp;gt;Messaging ===&lt;br /&gt;
&lt;br /&gt;
A message can either invoke a method of an object. set a property. or query a property. The syntax rules are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;200&amp;quot;|invoking a method:||&amp;#039;&amp;#039;(object method: parameters)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|setting a property:||&amp;#039;&amp;#039;(object property: expression)&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|querying a property:||&amp;#039;&amp;#039;(object property?)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While the punctuation following the selector (: and ?) arc optional to the compiler, they are &amp;lt;u&amp;gt;required&amp;lt;/u&amp;gt; by me.&lt;br /&gt;
&lt;br /&gt;
As mentioned in [[#The Dreaded Doit|section 3.1]] every message sent to an object requires 16 bytes of compiled object code. When you consider that often times there are many messages sent that you can&amp;#039;t see in your code, the total number of messages passed during the execution of one little room is astounding.&lt;br /&gt;
&lt;br /&gt;
For this reason it is important to optimize your messaging as much as possible. Store the result of a message if you will be using it frequently. Often this can be done in-line with other code. all in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if(= theObj (theScript client?))&lt;br /&gt;
        (theObj posn: 100 100)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By storing the result of &amp;#039;&amp;#039;(theScript client?)&amp;#039;&amp;#039; in the variable &amp;#039;&amp;#039;theObj&amp;#039;&amp;#039;, we have saved ourselves from having to query &amp;#039;&amp;#039;theScript&amp;#039;&amp;#039;&amp;#039;s client every time we want to use it.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 4.0 --&amp;gt;Indention ==&lt;br /&gt;
&lt;br /&gt;
More than any other factor, indention style can make code very readable or impossible to read. Different college instructors teach different methods, depending on their background and the language they teach, but here is the way I want to see code indented:&lt;br /&gt;
&lt;br /&gt;
*§ Set your tabs in [[BRIEF]] to 4. 7. This means the first lab is at column four and every lab thereafter is three columns apart.&lt;br /&gt;
*§ As a general rule, all statements in method, procedure, &amp;#039;&amp;#039;if&amp;#039;&amp;#039; or &amp;#039;&amp;#039;cond&amp;#039;&amp;#039; block, &amp;#039;&amp;#039;while&amp;#039;&amp;#039; or &amp;#039;&amp;#039;for&amp;#039;&amp;#039; loop, or &amp;#039;&amp;#039;switch&amp;#039;&amp;#039; statement should be indented to the nearest common column&lt;br /&gt;
*§ Values in property lists should be indented to the nearest common column ([[#Example1|see Example 1 below]]) &lt;br /&gt;
*§ Parameters in complex messages should be indented to the nearest common  column ([[#Example2|see Example 2 below]]) &lt;br /&gt;
*§ Closing parens should be outdented to the same column as their match &lt;br /&gt;
*§ Expressions in and or or statement should be indented to the nearest common column (see Example 3 below) &lt;br /&gt;
*§ The first expressing following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement should be on the same line as the statement ([[#Example3|see Example 3 below]]) &lt;br /&gt;
*§ Values in consecutive &amp;#039;&amp;#039;define&amp;#039;&amp;#039; statements should be indented to the nearest common column &lt;br /&gt;
*§ Initial values of local variables should be indented to the nearest common column &lt;br /&gt;
*§ Array elements should be indented to the nearest common column following either the array name or the open bracket ([[#Example4|see Example 4 below]])&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.1 --&amp;gt;Tabs vs. Spaces ===&lt;br /&gt;
&lt;br /&gt;
[[BRIEF]] will allow you to fill columns to the left of text with either tabs or spaces. I prefer tabs because they are easier to manage when moving code around. Get into the habit of using the TAB and SHIFT-TAB keys to indent and outdent blocks of code. You&amp;#039;ll save lots of time over manually inserting and deleting spaces.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.2 --&amp;gt;In &amp;#039;&amp;#039;If&amp;#039;&amp;#039; Blocks ===&lt;br /&gt;
&lt;br /&gt;
All statements that belong to a specific condition should be indented to the same column. Likewise, all expressions should be so aligned, with the first expression following an &amp;#039;&amp;#039;and&amp;#039;&amp;#039;, &amp;#039;&amp;#039;or&amp;#039;&amp;#039;, or &amp;#039;&amp;#039;not&amp;#039;&amp;#039; statement falling on the same line as the statement. ([[#Example3|See Example 3 for details]] or talk to me).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.3 --&amp;gt;In Properties Lists ===&lt;br /&gt;
&lt;br /&gt;
Values in properties lists should be indented to the nearest common tab, meaning that they will be aligned vertically in the tab position closest to the longest property name. I have a [[BRIEF#BRIEF Macros|BRIEF macro]] that automatically aligned property values which I will be happy to give you. ([[#Example1|see Example 1 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.4 --&amp;gt;In Complex Messages ===&lt;br /&gt;
&lt;br /&gt;
Similar to values in a properties list, parameters in a complex message should be indented to the nearest common tab. They should be aligned vertically in the tab position closest to the longest selector name. I have a BRIEF macro that automatically aligns complex message parameters which I will be happy to give you. ([[#Example2|See Example 2 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.5 --&amp;gt;In Arrays ===&lt;br /&gt;
&lt;br /&gt;
Initial values in arrays should be aligned with the nearest common tab following either the array name or the open bracket. While I prefer moving the open bracket to the line following the array name and indenting it one tab, this is against standard C coding conventions and so I won&amp;#039;t enforce it. The indention of the array elements, however, is required. ([[#Example4|See Example 4 for details]]).&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.6 --&amp;gt;Blank Lines ===&lt;br /&gt;
&lt;br /&gt;
Blank lines can be very helpful in setting groups of related statements apart from each other. I don&amp;#039;t have any hard fast rules about using blank lines; use your best judgment. If a blank line makes the code easier to read, put one in.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; &amp;lt;!-- 4.7 --&amp;gt;Examples ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 1: Indention of property values&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(properties&lt;br /&gt;
         x  5, &lt;br /&gt;
         Y  5, &lt;br /&gt;
         view  100 &lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example2&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 2: Indention of complex message parameters&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(theObj&lt;br /&gt;
        setLoop: 0,&lt;br /&gt;
        setCel: 0,&lt;br /&gt;
        setCycle: Forward&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example3&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 3: Indention of expressions&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(if	(and	(= = theView 100)&lt;br /&gt;
       (or	(theObj isKindOf. Thing)&lt;br /&gt;
       (theObj responds To: thingValue)&lt;br /&gt;
       )&lt;br /&gt;
       )&lt;br /&gt;
       (Print &amp;quot;Foo to all&amp;quot;)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div ID=&amp;quot;Example4&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&amp;#039;&amp;#039;&amp;#039;Example 4: Indention of array elements&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;SCI Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sci&amp;quot;&amp;gt;&lt;br /&gt;
(local	or	(local&lt;br /&gt;
    myArray =	    myArray = [&lt;br /&gt;
       [			valuel&lt;br /&gt;
    value1		value2&lt;br /&gt;
    value2	    ]&lt;br /&gt;
 ]		)&lt;br /&gt;
)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; &amp;lt;!-- 5.0 --&amp;gt;Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
There are a few Sierra standards concerning the naming of variables and objects that we will be using. Note: that capitalization is essential. The standard conventions are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|width=&amp;quot;250&amp;quot;|globals, locals, temps ||&amp;#039;&amp;#039;globalName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|flags ||&amp;#039;&amp;#039;tFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|point flags ||&amp;#039;&amp;#039;ptFlagName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, point ||&amp;#039;&amp;#039;ptsDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, text substitution ||&amp;#039;&amp;#039;defineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, numeric constant ||&amp;#039;&amp;#039;DEFINE_NAME&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|defines, external reference ||&amp;#039;&amp;#039;xDefineName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|classes ||&amp;#039;&amp;#039;ClassName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|procedures ||&amp;#039;&amp;#039;ProcedureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory enums ||&amp;#039;&amp;#039;iInvItemName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|views ||&amp;#039;&amp;#039;vViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|inventory views ||&amp;#039;&amp;#039;ivViewName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|pictures ||&amp;#039;&amp;#039;pPictureName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|actors ||&amp;#039;&amp;#039;aActorName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|talkers ||&amp;#039;&amp;#039;tTalkerName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|scripts ||&amp;#039;&amp;#039;sScriptName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|musIc ||&amp;#039;&amp;#039;mMusicName&amp;#039;&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
|sounds ||&amp;#039;&amp;#039;nSoundName&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you can think of other defines that should be in this list, let me know.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; The Part at the End ==&lt;br /&gt;
&lt;br /&gt;
In general, keep your code as clean and efficient as possible. Again, the rules in this text are not set in cement. Any comments or suggestions will certainly be &amp;lt;strike&amp;gt;laughed at&amp;lt;/strike&amp;gt; considered.&lt;br /&gt;
&lt;br /&gt;
The first time any of you break the above rules, you will be told nicely. The second time you will be told firmly. The third time I will personally dull all your pencils so they won&amp;#039;t stick in the ceiling anymore, change all occurrences of your name in the source code to Arvin Slatherlord Loudermilk III, and force you to take lunch lit 8:35 am for a week. So there.&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Notes ==&lt;br /&gt;
&lt;br /&gt;
From [[Corey Cole|Corey]]&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;1/3/92 &amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;To [[Brian K. Hughes|Brian]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 14pt&amp;quot;&amp;gt;Comments on LB2 Programming Manual&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I like it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Blank_Lines|Page 13-- Blank lines]]&amp;lt;br /&amp;gt;I like blank lines between all major blocks, objects, methods procedures, etc. Also after large blocks within methods (e.g. cond&amp;#039;s, etc.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#In Arrays|Page 13 -- example 4 (indentation of array elements)]]. Don&amp;#039;t worry about &amp;quot;c&amp;quot; standards -- Your first (preferred) approach is more readable should be the standard.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add to indentation standards: When sending messages or assigning values to several objects or variables in a row, indent to common tab.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;blockquote&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| width=&amp;quot;100&amp;quot; valign=&amp;quot;top&amp;quot;|Examples:||&amp;#039;&amp;#039;( = x    17)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;( = foobar    29)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(x    doit:   y 2)&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&amp;#039;&amp;#039;(foobar resind: TRUE)&amp;#039;&amp;#039;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Naming Conventions|Page 14]] -- I like your different naming conventions. How about &amp;#039;&amp;#039;dDefineName&amp;#039;&amp;#039; for text sub defines so they don&amp;#039;t look like variables (I&amp;#039;ve been using &amp;#039;&amp;#039;DefineName&amp;#039;&amp;#039;, but could switch).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[[#Messaging|Page 11 -- Messaging]] -- I use &amp;quot;?&amp;quot; when invoking a method which solely returns a value (i.e. a &amp;quot;property-like&amp;quot; method) -- &amp;quot;?&amp;quot; is for questions, &amp;quot;:&amp;quot; for &amp;lt;span class=&amp;quot;Alert&amp;quot;&amp;gt;imper?&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; References ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Related Links ==&lt;br /&gt;
&lt;br /&gt;
* [[Design Documents]]&lt;br /&gt;
* [[:Category:Scripting|Scripting]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Media:Laura_Bow_II_-_Programming_Style_Manual.pdf|Download the original Laura Bow II Programming Style Manual in PDF Form]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:References]]&lt;br /&gt;
[[Category:SCI Documentation]]&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Jeff_Stephenson&amp;diff=8782</id>
		<title>Jeff Stephenson</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Jeff_Stephenson&amp;diff=8782"/>
		<updated>2015-12-08T18:45:29Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Stub&lt;br /&gt;
&lt;br /&gt;
Jeff Stephenson&lt;br /&gt;
&lt;br /&gt;
[[File:Jeff_Stephenson.jpg]]&lt;br /&gt;
	&lt;br /&gt;
Jeff Stephenson&lt;br /&gt;
Designer &amp;amp; Programmer&lt;br /&gt;
1982-1993&lt;br /&gt;
&lt;br /&gt;
Jeff Stephenson created SCI (Sierra&amp;#039;s Creative Interpreter), the object-oriented scripting language of Sierra On-Line for its adventure games after the older AGI (a procedural language). Previously, he also was the head of Sierra’s AGI and SCI system programmers and responsible for much of the code of both of those languages. He originally called it LSCI, for Large-model Script Code Interpreter, and later SCI because it ran scripts, until someone in marketing found a better way to explain the acronym.&lt;br /&gt;
&lt;br /&gt;
He was one of the company&amp;#039;s first employees, struggling through the down times when Sierra almost went under. When Sierra got back on track, development began on King&amp;#039;s Quest.&lt;br /&gt;
&lt;br /&gt;
In the early nineties, as Sierra&amp;#039;s Lead Programmer, he was also involved with creating TSN (The Sierra Network), later INN (The ImagiNation Network), the architecture for online games. In 1992, he left the company for good.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Educational Background:&lt;br /&gt;
&lt;br /&gt;
Program Development, Interface Development&lt;br /&gt;
&lt;br /&gt;
Where Is He Now?: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
http://sciprogramming.com/community/index.php?topic=369.30&lt;br /&gt;
&lt;br /&gt;
http://www.mobygames.com/developer/sheet/view/developerId,52/&lt;br /&gt;
&lt;br /&gt;
http://www.allowe.com/games/larry/inside-stories/larryland.html&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m probably the last to know this, but anyway:&lt;br /&gt;
Jeff Stephenson is the brain behind Sierra&amp;#039;s SCI fame, and also partly responsible for AGI. He&amp;#039;s came up with the encryption string &amp;quot;AVIS DURGAN&amp;quot; used in AGI resources. Turns out Avis Durgan is not only a string, it is also the name of his wife, and lately they had some financial troubles which they shared with a reporter: &lt;br /&gt;
http://www.marketplace.org/topics/your-money/borrowers/good-credit-not-immune-cuts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Programming/Engineering - gameography&lt;br /&gt;
&lt;br /&gt;
* Crazy Nick&amp;#039;s Picks: King Graham&amp;#039;s Board Game Challenge (1993), Sierra On-Line, Inc.&lt;br /&gt;
* The Dagger of Amon Ra (1992), Sierra On-Line, Inc.&lt;br /&gt;
* Jones in the Fast Lane (Enhanced CDROM version) (1992), Sierra On-Line, Inc.&lt;br /&gt;
* Quest for Glory III: Wages of War (1992), Sierra On-Line, Inc.&lt;br /&gt;
* Castle of Dr. Brain (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Conquests of the Longbow: The Legend of Robin Hood (1991), Sierra On-Line, Inc.&lt;br /&gt;
* EcoQuest: The Search for Cetus (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Hoyle Official Book of Games: Volume 3 (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Jones in the Fast Lane (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Leisure Suit Larry 1: In the Land of the Lounge Lizards (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Leisure Suit Larry 5: Passionate Patti Does a Little Undercover Work (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Police Quest 3: The Kindred (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Roberta Williams&amp;#039; Mixed-Up Mother Goose (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Space Quest I: Roger Wilco in the Sarien Encounter (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Space Quest IV: Roger Wilco and the Time Rippers (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Conquests of Camelot: The Search for the Grail (1990), Sierra On-Line, Inc.&lt;br /&gt;
* Hoyle Official Book of Games: Volume 2 (1990), Sierra On-Line, Inc.&lt;br /&gt;
* King&amp;#039;s Quest V: Absence Makes the Heart Go Yonder! (1990), Sierra On-Line, Inc.&lt;br /&gt;
* Mixed-Up Mother Goose (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Quest for Glory II: Trial by Fire (1990), Sierra On-Line, Inc.&lt;br /&gt;
* Codename: ICEMAN (1989), Sierra On-Line, Inc.&lt;br /&gt;
* The Colonel&amp;#039;s Bequest (1989), Sierra On-Line, Inc.&lt;br /&gt;
* Hero&amp;#039;s Quest: So You Want To Be A Hero (1989), Sierra On-Line, Inc.&lt;br /&gt;
* Hoyle Official Book of Games: Volume 1 (1989), Sierra On-Line, Inc.&lt;br /&gt;
* Leisure Suit Larry III: Passionate Patti in Pursuit of the Pulsating Pectorals (1989), Sierra On-Line, Inc.&lt;br /&gt;
* Manhunter 2: San Francisco (1989), Sierra On-Line, Inc.&lt;br /&gt;
* Space Quest III: The Pirates of Pestulon (1989), Sierra On-Line, Inc.&lt;br /&gt;
* Gold Rush! (1988), Sierra On-Line, Inc.&lt;br /&gt;
* King&amp;#039;s Quest IV: The Perils of Rosella (1988), Sierra On-Line, Inc.&lt;br /&gt;
* Leisure Suit Larry Goes Looking for Love (In Several Wrong Places) (1988), Sierra On-Line, Inc.&lt;br /&gt;
* Manhunter: New York (1988), Sierra On-Line, Inc.&lt;br /&gt;
* Police Quest 2: The Vengeance (1988), Sierra On-Line, Inc.&lt;br /&gt;
* Leisure Suit Larry in the Land of the Lounge Lizards (1987), Sierra On-Line, Inc.&lt;br /&gt;
* Police Quest: In Pursuit of the Death Angel (1987), Sierra On-Line, Inc.&lt;br /&gt;
* Space Quest II: Chapter II - Vohaul&amp;#039;s Revenge (1987), Sierra On-Line, Inc.&lt;br /&gt;
* The Black Cauldron (1986), Sierra On-Line, Inc.&lt;br /&gt;
* King&amp;#039;s Quest III: To Heir is Human (1986), Sierra On-Line, Inc.&lt;br /&gt;
* Space Quest: The Sarien Encounter (1986), Sierra On-Line, Inc.&lt;br /&gt;
* King&amp;#039;s Quest II: Romancing the Throne (1985), Sierra On-Line, Inc.&lt;br /&gt;
* Donald Duck&amp;#039;s Playground (1986), Sierra On-Line, Inc.&lt;br /&gt;
* King&amp;#039;s Quest (1984), Sierra On-Line, Inc.&lt;br /&gt;
* Hi-Res Adventure #4: Ulysses and the Golden Fleece (1982), Sierra On-Line, Inc.&lt;br /&gt;
* Hi-Res Adventure #2: The Wizard and the Princess (1982), IBM&lt;br /&gt;
&lt;br /&gt;
Design - gameography&lt;br /&gt;
&lt;br /&gt;
* Mixed-Up Fairy Tales (1991), Sierra On-Line, Inc.&lt;br /&gt;
* King&amp;#039;s Quest V: Absence Makes the Heart Go Yonder! (1990), Sierra On-Line, Inc.&lt;br /&gt;
* Roberta Williams&amp;#039; King&amp;#039;s Quest I: Quest for the Crown (1990), Sierra On-Line, Inc.&lt;br /&gt;
* Leisure Suit Larry Goes Looking for Love (In Several Wrong Places) (1988), Sierra On-Line, Inc.&lt;br /&gt;
* Manhunter: New York (1988), Sierra On-Line, Inc.&lt;br /&gt;
* Police Quest 2: The Vengeance (1988), Sierra On-Line, Inc.&lt;br /&gt;
* Space Quest II: Chapter II - Vohaul&amp;#039;s Revenge (1987), Sierra On-Line, Inc.&lt;br /&gt;
* Space Quest: The Sarien Encounter (1986), Sierra On-Line, Inc.&lt;br /&gt;
* King&amp;#039;s Quest (1984), Sierra On-Line, Inc.&lt;br /&gt;
&lt;br /&gt;
Other - gameography&lt;br /&gt;
&lt;br /&gt;
* Police Quest: In Pursuit of the Death Angel (1992), Sierra On-Line, Inc.&lt;br /&gt;
* Police Quest 3: The Kindred (1991), Sierra On-Line, Inc.&lt;br /&gt;
* Leisure Suit Larry III: Passionate Patti in Pursuit of the Pulsating Pectorals (1989), Sierra On-Line, Inc.&lt;br /&gt;
* King&amp;#039;s Quest (1984), Sierra On-Line, Inc.&lt;br /&gt;
&lt;br /&gt;
Production - gameography&lt;br /&gt;
&lt;br /&gt;
    Hi-Res Adventure #5: Time Zone (1982), On-Line Systems&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Data_Types_and_Variables&amp;diff=8127</id>
		<title>The Script Programming Language/Data Types and Variables</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Data_Types_and_Variables&amp;diff=8127"/>
		<updated>2015-12-01T21:02:16Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Pointers: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[The Original SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
Chapter: &lt;br /&gt;
[[The Script Programming Language/Introduction|1]] | &lt;br /&gt;
[[The Script Programming Language/Files|2]] | &lt;br /&gt;
[[The Script Programming Language/Definitions|3]] | &lt;br /&gt;
[[The Script Programming Language/Data Types and Variables|4]] | &lt;br /&gt;
[[The Script Programming Language/Primitive Procedures|5]] | &lt;br /&gt;
[[The Script Programming Language/Control Flow|6]] | &lt;br /&gt;
[[The Script Programming Language/Procedures|7]] | &lt;br /&gt;
[[The Script Programming Language/Using SC|8]] | &lt;br /&gt;
[[The Script Programming Language/Index|Index]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;The Script Programming Language&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Data Types and Variables&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;Author: [[Jeff Stephenson]]&amp;#039;&amp;#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Data Types and Variables ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Numbers: ===&lt;br /&gt;
&lt;br /&gt;
All numbers in Script are 16 bit integers, giving a range of -32768 to +32767.   Numbers may be written as decimal (1024), hex ($400), or binary (%10000000000). &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Variables: ===&lt;br /&gt;
&lt;br /&gt;
Variables hold numbers.  Variables can be either global, local, or temporary, depending on when they are created and destroyed: &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global variables&amp;#039;&amp;#039;&amp;#039; are created when the program starts and destroyed when it ends, and are thus accessible to all scripts at all times. &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Local variables&amp;#039;&amp;#039;&amp;#039; are created when a logic script is loaded and destroyed when it is purged.  They are thus only available when the logic script is loaded and will not retain a value through a purge-reload cycle.  You will find that, as your programming takes on a more object-oriented flavor, you will use fewer and fewer local variables. &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Temporary variables&amp;#039;&amp;#039;&amp;#039; are created when a procedure or method is entered and destroyed when it is left.  They are thus only available to the declaring procedure and do not retain a value between calls to the procedure.  &lt;br /&gt;
 &lt;br /&gt;
In order to throw the &amp;#039;link&amp;#039; out of the traditional &amp;#039;edit-compile-     &lt;br /&gt;
link-test&amp;#039; cycle of software development, YOU, rather than the linker, must &lt;br /&gt;
define the address (i.e. variable number) of global variables.  This is done &lt;br /&gt;
with the global definition: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(global &lt;br /&gt;
     var-name var-number &lt;br /&gt;
     var-name var-number &lt;br /&gt;
     ... &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This defines var-name to be global variable number var-number.&lt;br /&gt;
 &lt;br /&gt;
Local variables, not being accessible outside of the scripts in which they are declared and thus not requiring linking, can have their addresses set by the Script compiler.  There are two ways of defining locals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local &lt;br /&gt;
     var-name &lt;br /&gt;
     var-name &lt;br /&gt;
     ... &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines a single variables with the names var-name. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local [array-name n]) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines an array of n elements with the name array-name (the brackets in this do NOT mean &amp;#039;optional&amp;#039; -- they are required). &lt;br /&gt;
 &lt;br /&gt;
Multiple local variable definitions may be combined in one statement: &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local &lt;br /&gt;
     var1 &lt;br /&gt;
     [array1 10] &lt;br /&gt;
     [array2 5] &lt;br /&gt;
     var2 &lt;br /&gt;
          . &lt;br /&gt;
          . &lt;br /&gt;
          . &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Temporary variables will be discussed in the section on user-defined procedures. &lt;br /&gt;
 &lt;br /&gt;
Define and enum statements may be included within both global and local variable definitions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Arrays: ===&lt;br /&gt;
&lt;br /&gt;
To access element n of the array anArray, write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
[anArray n] &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Despite the syntactic difference between local variable declarations and local array declarations, there really is no distinction between variables and arrays -- any variable may be indexed as an array.  Thus, if we have the local variable declarations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local&lt;br /&gt;
     var1&lt;br /&gt;
     var2&lt;br /&gt;
     var3&lt;br /&gt;
     var4&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can set the value of var1 to that of var4 by any of the following statements: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= var1 var4)&lt;br /&gt;
(= var1 [var2 2])&lt;br /&gt;
(= var1 [var3 1])&lt;br /&gt;
(= [var2 -1] [var1 3])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first method is obviously the preferred method for clarity, but this array property of all variables allows access to variable numbers of parameters in a user-defined procedure (see section on user-defined procedures).&lt;br /&gt;
 &lt;br /&gt;
This property of variables is also the basis of the method by which you declare global arrays -- you simply leave an array-sized gap in the global variable numbering sequence.  To declare var2 as a global array of 10 elements, write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(global &lt;br /&gt;
     var1      23&lt;br /&gt;
     var2      24&lt;br /&gt;
                    ;10 element array&lt;br /&gt;
     var3      34&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and access var2 as an array: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
[var2 7]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Pointers: ===&lt;br /&gt;
&lt;br /&gt;
Some kernel calls require pointers to variables, rather than the value of a variable.  A pointer to a variable is created by preceding a variable reference with the &amp;#039;&amp;lt;tt&amp;gt;@&amp;lt;/tt&amp;gt;&amp;#039; sign.  Pointers may be created to array elements as well as to simple variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
@ego           ;pointer to the variable ego&lt;br /&gt;
@[foo 3]       ;pointer to fourth element of array foo &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since there is currently no way in sc to dereference a pointer, this is only useful for passing pointers to kernel calls.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Text: ===&lt;br /&gt;
&lt;br /&gt;
Text strings are strings of characters enclosed in double quotes, and may be used anywhere you like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(Print &amp;quot;This is immediate text.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
prints the text string, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= textToPrint &amp;quot;This text is referenced through a variable.&amp;quot;) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sets the variable to a pointer to the text string, and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(instance foo of Bar &lt;br /&gt;
     (properties &lt;br /&gt;
          name:&amp;quot;fooBar&amp;quot; &lt;br /&gt;
     )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sets the name property of foo to be a pointer to the text string.&lt;br /&gt;
&lt;br /&gt;
When sc goes to squirrel a text string away, it first checks to see if it &lt;br /&gt;
has seen the string before.  If so, it just uses the previous text, rather &lt;br /&gt;
than duplicating the text.  For long text strings which are used in several &lt;br /&gt;
places, however, the likelihood that you will manage to type the text &lt;br /&gt;
identically in each case is small.  In this case you can simply put the text &lt;br /&gt;
in a define statement &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(define lotsOftext  &amp;quot;This is a long text string. I am using a  &lt;br /&gt;
                     define statement to avoid having to type  &lt;br /&gt;
                     it repeatedly.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This introduces another aspect of text strings: If text is too long fit on a single line, you may enter it on several lines.  Multiple white-space (spaces, tabs, and newlines) gets converted to a single space, so the text above ends up with just one space between the words on each line.  If you want multiple spaces, enter them as underbars, &amp;#039;&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;&amp;#039;.  These are converted to spaces in the string, but are not compacted. &lt;br /&gt;
&lt;br /&gt;
To include a &amp;#039;&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;&amp;#039; in text, type &amp;#039;&amp;lt;tt&amp;gt;\_&amp;lt;/tt&amp;gt;&amp;#039;, where &amp;#039;&amp;lt;tt&amp;gt;\&amp;lt;/tt&amp;gt;&amp;#039; is the escape character. Explicit newlines are entered just as in C: &amp;#039;&amp;lt;tt&amp;gt;\n&amp;lt;/tt&amp;gt;&amp;#039;.  A CR/LF pair is entered as &amp;#039;&amp;lt;tt&amp;gt;\r&amp;lt;/tt&amp;gt;&amp;#039; (the &amp;#039;&amp;lt;tt&amp;gt;\r&amp;lt;/tt&amp;gt;&amp;#039; should be used in place of &amp;#039;&amp;lt;tt&amp;gt;\n&amp;lt;/tt&amp;gt;&amp;#039; in all strings destined for a file).  Characters which are not on the keyboard, but are defined in a font (such as the Sierra symbol in the menubar) can be included in the string by preceding the two-digit hex value of the character with the &amp;#039;&amp;lt;tt&amp;gt;\&amp;lt;/tt&amp;gt;&amp;#039;. Thus, &amp;lt;code&amp;gt;&amp;quot;This is the Sierra symbol: \01&amp;quot;&amp;lt;/code&amp;gt; would put the value 1 at the end of the string, and this character in the font is the Sierra symbol.&lt;br /&gt;
&lt;br /&gt;
The maximum length of a text string is 2000 bytes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Word-strings: ===&lt;br /&gt;
&lt;br /&gt;
Word-strings are used to represent templates for user input in Said statements.  A word-string is a string enclosed in single quotes which contains meta-characters describing the content of a sentence.  The meta-characters and their meanings are described in the separate Vocabulary documentation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(if (Said &amp;#039;give/pirate/gold coins&amp;lt;#&amp;#039; @howMany) &lt;br /&gt;
      (Print &amp;quot;Get lost creep.&amp;quot;)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with text strings, identical strings are stored only once.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Characters: ===&lt;br /&gt;
&lt;br /&gt;
Characters are single ASCII characters, and are denoted by preceding the character with the reverse single quote (&amp;quot;tick&amp;quot;) character:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`A&amp;lt;/code&amp;gt;   represents uppercase A and &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`?&amp;lt;/code&amp;gt;   represents the question mark &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several character sequences represent special key combinations: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`^a&amp;lt;/code&amp;gt;  represents ctrl-A &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`@b&amp;lt;/code&amp;gt;  represents alt-B &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`#4&amp;lt;/code&amp;gt;  represents the F4 key &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Literal selectors: ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, as in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(cast eachElementDo: #showSelf:)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you want to send the value of selector rather than use the selector as the start of another message to an object (these terms will be described in Object Oriented Programming in Script).  Preceding the selector with a &amp;#039;#&amp;#039; produces the literal value of the selector rather than using it as a message.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[The Script Programming Language | Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: left&amp;quot;&amp;gt;[[The Script Programming Language/Definitions | &amp;amp;lt; Previous: Definitions]]&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[The Script Programming Language/Primitive Procedures | Next: Primitive Procedures &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:SCI Documentation]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Data_Types_and_Variables&amp;diff=8126</id>
		<title>The Script Programming Language/Data Types and Variables</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Data_Types_and_Variables&amp;diff=8126"/>
		<updated>2015-12-01T21:01:49Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Text: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[The Original SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
Chapter: &lt;br /&gt;
[[The Script Programming Language/Introduction|1]] | &lt;br /&gt;
[[The Script Programming Language/Files|2]] | &lt;br /&gt;
[[The Script Programming Language/Definitions|3]] | &lt;br /&gt;
[[The Script Programming Language/Data Types and Variables|4]] | &lt;br /&gt;
[[The Script Programming Language/Primitive Procedures|5]] | &lt;br /&gt;
[[The Script Programming Language/Control Flow|6]] | &lt;br /&gt;
[[The Script Programming Language/Procedures|7]] | &lt;br /&gt;
[[The Script Programming Language/Using SC|8]] | &lt;br /&gt;
[[The Script Programming Language/Index|Index]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;The Script Programming Language&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Data Types and Variables&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;Author: [[Jeff Stephenson]]&amp;#039;&amp;#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Data Types and Variables ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Numbers: ===&lt;br /&gt;
&lt;br /&gt;
All numbers in Script are 16 bit integers, giving a range of -32768 to +32767.   Numbers may be written as decimal (1024), hex ($400), or binary (%10000000000). &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Variables: ===&lt;br /&gt;
&lt;br /&gt;
Variables hold numbers.  Variables can be either global, local, or temporary, depending on when they are created and destroyed: &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global variables&amp;#039;&amp;#039;&amp;#039; are created when the program starts and destroyed when it ends, and are thus accessible to all scripts at all times. &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Local variables&amp;#039;&amp;#039;&amp;#039; are created when a logic script is loaded and destroyed when it is purged.  They are thus only available when the logic script is loaded and will not retain a value through a purge-reload cycle.  You will find that, as your programming takes on a more object-oriented flavor, you will use fewer and fewer local variables. &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Temporary variables&amp;#039;&amp;#039;&amp;#039; are created when a procedure or method is entered and destroyed when it is left.  They are thus only available to the declaring procedure and do not retain a value between calls to the procedure.  &lt;br /&gt;
 &lt;br /&gt;
In order to throw the &amp;#039;link&amp;#039; out of the traditional &amp;#039;edit-compile-     &lt;br /&gt;
link-test&amp;#039; cycle of software development, YOU, rather than the linker, must &lt;br /&gt;
define the address (i.e. variable number) of global variables.  This is done &lt;br /&gt;
with the global definition: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(global &lt;br /&gt;
     var-name var-number &lt;br /&gt;
     var-name var-number &lt;br /&gt;
     ... &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This defines var-name to be global variable number var-number.&lt;br /&gt;
 &lt;br /&gt;
Local variables, not being accessible outside of the scripts in which they are declared and thus not requiring linking, can have their addresses set by the Script compiler.  There are two ways of defining locals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local &lt;br /&gt;
     var-name &lt;br /&gt;
     var-name &lt;br /&gt;
     ... &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines a single variables with the names var-name. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local [array-name n]) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines an array of n elements with the name array-name (the brackets in this do NOT mean &amp;#039;optional&amp;#039; -- they are required). &lt;br /&gt;
 &lt;br /&gt;
Multiple local variable definitions may be combined in one statement: &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local &lt;br /&gt;
     var1 &lt;br /&gt;
     [array1 10] &lt;br /&gt;
     [array2 5] &lt;br /&gt;
     var2 &lt;br /&gt;
          . &lt;br /&gt;
          . &lt;br /&gt;
          . &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Temporary variables will be discussed in the section on user-defined procedures. &lt;br /&gt;
 &lt;br /&gt;
Define and enum statements may be included within both global and local variable definitions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Arrays: ===&lt;br /&gt;
&lt;br /&gt;
To access element n of the array anArray, write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
[anArray n] &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Despite the syntactic difference between local variable declarations and local array declarations, there really is no distinction between variables and arrays -- any variable may be indexed as an array.  Thus, if we have the local variable declarations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local&lt;br /&gt;
     var1&lt;br /&gt;
     var2&lt;br /&gt;
     var3&lt;br /&gt;
     var4&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can set the value of var1 to that of var4 by any of the following statements: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= var1 var4)&lt;br /&gt;
(= var1 [var2 2])&lt;br /&gt;
(= var1 [var3 1])&lt;br /&gt;
(= [var2 -1] [var1 3])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first method is obviously the preferred method for clarity, but this array property of all variables allows access to variable numbers of parameters in a user-defined procedure (see section on user-defined procedures).&lt;br /&gt;
 &lt;br /&gt;
This property of variables is also the basis of the method by which you declare global arrays -- you simply leave an array-sized gap in the global variable numbering sequence.  To declare var2 as a global array of 10 elements, write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(global &lt;br /&gt;
     var1      23&lt;br /&gt;
     var2      24&lt;br /&gt;
                    ;10 element array&lt;br /&gt;
     var3      34&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and access var2 as an array: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
[var2 7]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Pointers: ===&lt;br /&gt;
&lt;br /&gt;
Some kernel calls require pointers to variables, rather than the value of a variable.  A pointer to a variable is created by preceding a variable reference with the &amp;#039;@&amp;#039; sign.  Pointers may be created to array elements as well as to simple variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
@ego           ;pointer to the variable ego&lt;br /&gt;
@[foo 3]       ;pointer to fourth element of array foo &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since there is currently no way in sc to dereference a pointer, this is only useful for passing pointers to kernel calls.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Text: ===&lt;br /&gt;
&lt;br /&gt;
Text strings are strings of characters enclosed in double quotes, and may be used anywhere you like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(Print &amp;quot;This is immediate text.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
prints the text string, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= textToPrint &amp;quot;This text is referenced through a variable.&amp;quot;) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sets the variable to a pointer to the text string, and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(instance foo of Bar &lt;br /&gt;
     (properties &lt;br /&gt;
          name:&amp;quot;fooBar&amp;quot; &lt;br /&gt;
     )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sets the name property of foo to be a pointer to the text string.&lt;br /&gt;
&lt;br /&gt;
When sc goes to squirrel a text string away, it first checks to see if it &lt;br /&gt;
has seen the string before.  If so, it just uses the previous text, rather &lt;br /&gt;
than duplicating the text.  For long text strings which are used in several &lt;br /&gt;
places, however, the likelihood that you will manage to type the text &lt;br /&gt;
identically in each case is small.  In this case you can simply put the text &lt;br /&gt;
in a define statement &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(define lotsOftext  &amp;quot;This is a long text string. I am using a  &lt;br /&gt;
                     define statement to avoid having to type  &lt;br /&gt;
                     it repeatedly.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This introduces another aspect of text strings: If text is too long fit on a single line, you may enter it on several lines.  Multiple white-space (spaces, tabs, and newlines) gets converted to a single space, so the text above ends up with just one space between the words on each line.  If you want multiple spaces, enter them as underbars, &amp;#039;&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;&amp;#039;.  These are converted to spaces in the string, but are not compacted. &lt;br /&gt;
&lt;br /&gt;
To include a &amp;#039;&amp;lt;tt&amp;gt;_&amp;lt;/tt&amp;gt;&amp;#039; in text, type &amp;#039;&amp;lt;tt&amp;gt;\_&amp;lt;/tt&amp;gt;&amp;#039;, where &amp;#039;&amp;lt;tt&amp;gt;\&amp;lt;/tt&amp;gt;&amp;#039; is the escape character. Explicit newlines are entered just as in C: &amp;#039;&amp;lt;tt&amp;gt;\n&amp;lt;/tt&amp;gt;&amp;#039;.  A CR/LF pair is entered as &amp;#039;&amp;lt;tt&amp;gt;\r&amp;lt;/tt&amp;gt;&amp;#039; (the &amp;#039;&amp;lt;tt&amp;gt;\r&amp;lt;/tt&amp;gt;&amp;#039; should be used in place of &amp;#039;&amp;lt;tt&amp;gt;\n&amp;lt;/tt&amp;gt;&amp;#039; in all strings destined for a file).  Characters which are not on the keyboard, but are defined in a font (such as the Sierra symbol in the menubar) can be included in the string by preceding the two-digit hex value of the character with the &amp;#039;&amp;lt;tt&amp;gt;\&amp;lt;/tt&amp;gt;&amp;#039;. Thus, &amp;lt;code&amp;gt;&amp;quot;This is the Sierra symbol: \01&amp;quot;&amp;lt;/code&amp;gt; would put the value 1 at the end of the string, and this character in the font is the Sierra symbol.&lt;br /&gt;
&lt;br /&gt;
The maximum length of a text string is 2000 bytes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Word-strings: ===&lt;br /&gt;
&lt;br /&gt;
Word-strings are used to represent templates for user input in Said statements.  A word-string is a string enclosed in single quotes which contains meta-characters describing the content of a sentence.  The meta-characters and their meanings are described in the separate Vocabulary documentation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(if (Said &amp;#039;give/pirate/gold coins&amp;lt;#&amp;#039; @howMany) &lt;br /&gt;
      (Print &amp;quot;Get lost creep.&amp;quot;)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with text strings, identical strings are stored only once.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Characters: ===&lt;br /&gt;
&lt;br /&gt;
Characters are single ASCII characters, and are denoted by preceding the character with the reverse single quote (&amp;quot;tick&amp;quot;) character:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`A&amp;lt;/code&amp;gt;   represents uppercase A and &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`?&amp;lt;/code&amp;gt;   represents the question mark &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several character sequences represent special key combinations: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`^a&amp;lt;/code&amp;gt;  represents ctrl-A &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`@b&amp;lt;/code&amp;gt;  represents alt-B &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`#4&amp;lt;/code&amp;gt;  represents the F4 key &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Literal selectors: ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, as in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(cast eachElementDo: #showSelf:)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you want to send the value of selector rather than use the selector as the start of another message to an object (these terms will be described in Object Oriented Programming in Script).  Preceding the selector with a &amp;#039;#&amp;#039; produces the literal value of the selector rather than using it as a message.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[The Script Programming Language | Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: left&amp;quot;&amp;gt;[[The Script Programming Language/Definitions | &amp;amp;lt; Previous: Definitions]]&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[The Script Programming Language/Primitive Procedures | Next: Primitive Procedures &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:SCI Documentation]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Data_Types_and_Variables&amp;diff=8125</id>
		<title>The Script Programming Language/Data Types and Variables</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Data_Types_and_Variables&amp;diff=8125"/>
		<updated>2015-12-01T20:53:29Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Characters: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[The Original SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
Chapter: &lt;br /&gt;
[[The Script Programming Language/Introduction|1]] | &lt;br /&gt;
[[The Script Programming Language/Files|2]] | &lt;br /&gt;
[[The Script Programming Language/Definitions|3]] | &lt;br /&gt;
[[The Script Programming Language/Data Types and Variables|4]] | &lt;br /&gt;
[[The Script Programming Language/Primitive Procedures|5]] | &lt;br /&gt;
[[The Script Programming Language/Control Flow|6]] | &lt;br /&gt;
[[The Script Programming Language/Procedures|7]] | &lt;br /&gt;
[[The Script Programming Language/Using SC|8]] | &lt;br /&gt;
[[The Script Programming Language/Index|Index]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;The Script Programming Language&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Data Types and Variables&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;Author: [[Jeff Stephenson]]&amp;#039;&amp;#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Data Types and Variables ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Numbers: ===&lt;br /&gt;
&lt;br /&gt;
All numbers in Script are 16 bit integers, giving a range of -32768 to +32767.   Numbers may be written as decimal (1024), hex ($400), or binary (%10000000000). &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Variables: ===&lt;br /&gt;
&lt;br /&gt;
Variables hold numbers.  Variables can be either global, local, or temporary, depending on when they are created and destroyed: &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global variables&amp;#039;&amp;#039;&amp;#039; are created when the program starts and destroyed when it ends, and are thus accessible to all scripts at all times. &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Local variables&amp;#039;&amp;#039;&amp;#039; are created when a logic script is loaded and destroyed when it is purged.  They are thus only available when the logic script is loaded and will not retain a value through a purge-reload cycle.  You will find that, as your programming takes on a more object-oriented flavor, you will use fewer and fewer local variables. &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Temporary variables&amp;#039;&amp;#039;&amp;#039; are created when a procedure or method is entered and destroyed when it is left.  They are thus only available to the declaring procedure and do not retain a value between calls to the procedure.  &lt;br /&gt;
 &lt;br /&gt;
In order to throw the &amp;#039;link&amp;#039; out of the traditional &amp;#039;edit-compile-     &lt;br /&gt;
link-test&amp;#039; cycle of software development, YOU, rather than the linker, must &lt;br /&gt;
define the address (i.e. variable number) of global variables.  This is done &lt;br /&gt;
with the global definition: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(global &lt;br /&gt;
     var-name var-number &lt;br /&gt;
     var-name var-number &lt;br /&gt;
     ... &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This defines var-name to be global variable number var-number.&lt;br /&gt;
 &lt;br /&gt;
Local variables, not being accessible outside of the scripts in which they are declared and thus not requiring linking, can have their addresses set by the Script compiler.  There are two ways of defining locals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local &lt;br /&gt;
     var-name &lt;br /&gt;
     var-name &lt;br /&gt;
     ... &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines a single variables with the names var-name. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local [array-name n]) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines an array of n elements with the name array-name (the brackets in this do NOT mean &amp;#039;optional&amp;#039; -- they are required). &lt;br /&gt;
 &lt;br /&gt;
Multiple local variable definitions may be combined in one statement: &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local &lt;br /&gt;
     var1 &lt;br /&gt;
     [array1 10] &lt;br /&gt;
     [array2 5] &lt;br /&gt;
     var2 &lt;br /&gt;
          . &lt;br /&gt;
          . &lt;br /&gt;
          . &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Temporary variables will be discussed in the section on user-defined procedures. &lt;br /&gt;
 &lt;br /&gt;
Define and enum statements may be included within both global and local variable definitions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Arrays: ===&lt;br /&gt;
&lt;br /&gt;
To access element n of the array anArray, write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
[anArray n] &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Despite the syntactic difference between local variable declarations and local array declarations, there really is no distinction between variables and arrays -- any variable may be indexed as an array.  Thus, if we have the local variable declarations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local&lt;br /&gt;
     var1&lt;br /&gt;
     var2&lt;br /&gt;
     var3&lt;br /&gt;
     var4&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can set the value of var1 to that of var4 by any of the following statements: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= var1 var4)&lt;br /&gt;
(= var1 [var2 2])&lt;br /&gt;
(= var1 [var3 1])&lt;br /&gt;
(= [var2 -1] [var1 3])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first method is obviously the preferred method for clarity, but this array property of all variables allows access to variable numbers of parameters in a user-defined procedure (see section on user-defined procedures).&lt;br /&gt;
 &lt;br /&gt;
This property of variables is also the basis of the method by which you declare global arrays -- you simply leave an array-sized gap in the global variable numbering sequence.  To declare var2 as a global array of 10 elements, write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(global &lt;br /&gt;
     var1      23&lt;br /&gt;
     var2      24&lt;br /&gt;
                    ;10 element array&lt;br /&gt;
     var3      34&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and access var2 as an array: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
[var2 7]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Pointers: ===&lt;br /&gt;
&lt;br /&gt;
Some kernel calls require pointers to variables, rather than the value of a variable.  A pointer to a variable is created by preceding a variable reference with the &amp;#039;@&amp;#039; sign.  Pointers may be created to array elements as well as to simple variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
@ego           ;pointer to the variable ego&lt;br /&gt;
@[foo 3]       ;pointer to fourth element of array foo &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since there is currently no way in sc to dereference a pointer, this is only useful for passing pointers to kernel calls.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Text: ===&lt;br /&gt;
&lt;br /&gt;
Text strings are strings of characters enclosed in double quotes, and may be used anywhere you like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(Print &amp;quot;This is immediate text.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
prints the text string, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= textToPrint &amp;quot;This text is referenced through a variable.&amp;quot;) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sets the variable to a pointer to the text string, and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(instance foo of Bar &lt;br /&gt;
     (properties &lt;br /&gt;
          name:&amp;quot;fooBar&amp;quot; &lt;br /&gt;
     )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sets the name property of foo to be a pointer to the text string.&lt;br /&gt;
&lt;br /&gt;
When sc goes to squirrel a text string away, it first checks to see if it &lt;br /&gt;
has seen the string before.  If so, it just uses the previous text, rather &lt;br /&gt;
than duplicating the text.  For long text strings which are used in several &lt;br /&gt;
places, however, the likelihood that you will manage to type the text &lt;br /&gt;
identically in each case is small.  In this case you can simply put the text &lt;br /&gt;
in a define statement &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(define lotsOftext  &amp;quot;This is a long text string. I am using a  &lt;br /&gt;
                     define statement to avoid having to type  &lt;br /&gt;
                     it repeatedly.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This introduces another aspect of text strings: If text is too long fit on a single line, you may enter it on several lines.  Multiple white-space (spaces, tabs, and newlines) gets converted to a single space, so the text above ends up with just one space between the words on each line.  If you want multiple spaces, enter them as underbars, &amp;#039;_&amp;#039;.  These are converted to spaces in the string, but are not compacted. &lt;br /&gt;
&lt;br /&gt;
To include a &amp;#039;_&amp;#039; in text, type &amp;#039;\_&amp;#039;, where &amp;#039;\&amp;#039; is the escape character. Explicit newlines are entered just as in C: &amp;#039;\n&amp;#039;.  A CR/LF pair is entered as &amp;#039;\r&amp;#039; (the &amp;#039;\r&amp;#039; should be used in place of &amp;#039;\n&amp;#039; in all strings destined for a file).  Characters which are not on the keyboard, but are defined in a font (such as the Sierra symbol in the menubar) can be included in the string by preceding the two-digit hex value of the character with the &amp;#039;\&amp;#039;. Thus, &amp;quot;This is the Sierra symbol: \01&amp;quot; would put the value 1 at the end of the string, and this character in the font is the Sierra symbol.&lt;br /&gt;
&lt;br /&gt;
The maximum length of a text string is 2000 bytes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Word-strings: ===&lt;br /&gt;
&lt;br /&gt;
Word-strings are used to represent templates for user input in Said statements.  A word-string is a string enclosed in single quotes which contains meta-characters describing the content of a sentence.  The meta-characters and their meanings are described in the separate Vocabulary documentation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(if (Said &amp;#039;give/pirate/gold coins&amp;lt;#&amp;#039; @howMany) &lt;br /&gt;
      (Print &amp;quot;Get lost creep.&amp;quot;)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with text strings, identical strings are stored only once.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Characters: ===&lt;br /&gt;
&lt;br /&gt;
Characters are single ASCII characters, and are denoted by preceding the character with the reverse single quote (&amp;quot;tick&amp;quot;) character:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`A&amp;lt;/code&amp;gt;   represents uppercase A and &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`?&amp;lt;/code&amp;gt;   represents the question mark &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several character sequences represent special key combinations: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`^a&amp;lt;/code&amp;gt;  represents ctrl-A &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`@b&amp;lt;/code&amp;gt;  represents alt-B &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;`#4&amp;lt;/code&amp;gt;  represents the F4 key &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Literal selectors: ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, as in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(cast eachElementDo: #showSelf:)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you want to send the value of selector rather than use the selector as the start of another message to an object (these terms will be described in Object Oriented Programming in Script).  Preceding the selector with a &amp;#039;#&amp;#039; produces the literal value of the selector rather than using it as a message.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[The Script Programming Language | Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: left&amp;quot;&amp;gt;[[The Script Programming Language/Definitions | &amp;amp;lt; Previous: Definitions]]&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[The Script Programming Language/Primitive Procedures | Next: Primitive Procedures &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:SCI Documentation]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Data_Types_and_Variables&amp;diff=8124</id>
		<title>The Script Programming Language/Data Types and Variables</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Data_Types_and_Variables&amp;diff=8124"/>
		<updated>2015-12-01T20:47:06Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /*  Text: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[The Original SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
Chapter: &lt;br /&gt;
[[The Script Programming Language/Introduction|1]] | &lt;br /&gt;
[[The Script Programming Language/Files|2]] | &lt;br /&gt;
[[The Script Programming Language/Definitions|3]] | &lt;br /&gt;
[[The Script Programming Language/Data Types and Variables|4]] | &lt;br /&gt;
[[The Script Programming Language/Primitive Procedures|5]] | &lt;br /&gt;
[[The Script Programming Language/Control Flow|6]] | &lt;br /&gt;
[[The Script Programming Language/Procedures|7]] | &lt;br /&gt;
[[The Script Programming Language/Using SC|8]] | &lt;br /&gt;
[[The Script Programming Language/Index|Index]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;The Script Programming Language&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Data Types and Variables&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;Author: [[Jeff Stephenson]]&amp;#039;&amp;#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;br /&amp;gt; Data Types and Variables ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Numbers: ===&lt;br /&gt;
&lt;br /&gt;
All numbers in Script are 16 bit integers, giving a range of -32768 to +32767.   Numbers may be written as decimal (1024), hex ($400), or binary (%10000000000). &lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Variables: ===&lt;br /&gt;
&lt;br /&gt;
Variables hold numbers.  Variables can be either global, local, or temporary, depending on when they are created and destroyed: &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Global variables&amp;#039;&amp;#039;&amp;#039; are created when the program starts and destroyed when it ends, and are thus accessible to all scripts at all times. &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Local variables&amp;#039;&amp;#039;&amp;#039; are created when a logic script is loaded and destroyed when it is purged.  They are thus only available when the logic script is loaded and will not retain a value through a purge-reload cycle.  You will find that, as your programming takes on a more object-oriented flavor, you will use fewer and fewer local variables. &lt;br /&gt;
 &lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Temporary variables&amp;#039;&amp;#039;&amp;#039; are created when a procedure or method is entered and destroyed when it is left.  They are thus only available to the declaring procedure and do not retain a value between calls to the procedure.  &lt;br /&gt;
 &lt;br /&gt;
In order to throw the &amp;#039;link&amp;#039; out of the traditional &amp;#039;edit-compile-     &lt;br /&gt;
link-test&amp;#039; cycle of software development, YOU, rather than the linker, must &lt;br /&gt;
define the address (i.e. variable number) of global variables.  This is done &lt;br /&gt;
with the global definition: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(global &lt;br /&gt;
     var-name var-number &lt;br /&gt;
     var-name var-number &lt;br /&gt;
     ... &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This defines var-name to be global variable number var-number.&lt;br /&gt;
 &lt;br /&gt;
Local variables, not being accessible outside of the scripts in which they are declared and thus not requiring linking, can have their addresses set by the Script compiler.  There are two ways of defining locals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local &lt;br /&gt;
     var-name &lt;br /&gt;
     var-name &lt;br /&gt;
     ... &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines a single variables with the names var-name. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local [array-name n]) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defines an array of n elements with the name array-name (the brackets in this do NOT mean &amp;#039;optional&amp;#039; -- they are required). &lt;br /&gt;
 &lt;br /&gt;
Multiple local variable definitions may be combined in one statement: &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local &lt;br /&gt;
     var1 &lt;br /&gt;
     [array1 10] &lt;br /&gt;
     [array2 5] &lt;br /&gt;
     var2 &lt;br /&gt;
          . &lt;br /&gt;
          . &lt;br /&gt;
          . &lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Temporary variables will be discussed in the section on user-defined procedures. &lt;br /&gt;
 &lt;br /&gt;
Define and enum statements may be included within both global and local variable definitions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;br /&amp;gt; Arrays: ===&lt;br /&gt;
&lt;br /&gt;
To access element n of the array anArray, write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
[anArray n] &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Despite the syntactic difference between local variable declarations and local array declarations, there really is no distinction between variables and arrays -- any variable may be indexed as an array.  Thus, if we have the local variable declarations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(local&lt;br /&gt;
     var1&lt;br /&gt;
     var2&lt;br /&gt;
     var3&lt;br /&gt;
     var4&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we can set the value of var1 to that of var4 by any of the following statements: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= var1 var4)&lt;br /&gt;
(= var1 [var2 2])&lt;br /&gt;
(= var1 [var3 1])&lt;br /&gt;
(= [var2 -1] [var1 3])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first method is obviously the preferred method for clarity, but this array property of all variables allows access to variable numbers of parameters in a user-defined procedure (see section on user-defined procedures).&lt;br /&gt;
 &lt;br /&gt;
This property of variables is also the basis of the method by which you declare global arrays -- you simply leave an array-sized gap in the global variable numbering sequence.  To declare var2 as a global array of 10 elements, write&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(global &lt;br /&gt;
     var1      23&lt;br /&gt;
     var2      24&lt;br /&gt;
                    ;10 element array&lt;br /&gt;
     var3      34&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and access var2 as an array: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
[var2 7]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Pointers: ===&lt;br /&gt;
&lt;br /&gt;
Some kernel calls require pointers to variables, rather than the value of a variable.  A pointer to a variable is created by preceding a variable reference with the &amp;#039;@&amp;#039; sign.  Pointers may be created to array elements as well as to simple variables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
@ego           ;pointer to the variable ego&lt;br /&gt;
@[foo 3]       ;pointer to fourth element of array foo &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since there is currently no way in sc to dereference a pointer, this is only useful for passing pointers to kernel calls.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Text: ===&lt;br /&gt;
&lt;br /&gt;
Text strings are strings of characters enclosed in double quotes, and may be used anywhere you like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(Print &amp;quot;This is immediate text.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
prints the text string, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= textToPrint &amp;quot;This text is referenced through a variable.&amp;quot;) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sets the variable to a pointer to the text string, and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(instance foo of Bar &lt;br /&gt;
     (properties &lt;br /&gt;
          name:&amp;quot;fooBar&amp;quot; &lt;br /&gt;
     )&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sets the name property of foo to be a pointer to the text string.&lt;br /&gt;
&lt;br /&gt;
When sc goes to squirrel a text string away, it first checks to see if it &lt;br /&gt;
has seen the string before.  If so, it just uses the previous text, rather &lt;br /&gt;
than duplicating the text.  For long text strings which are used in several &lt;br /&gt;
places, however, the likelihood that you will manage to type the text &lt;br /&gt;
identically in each case is small.  In this case you can simply put the text &lt;br /&gt;
in a define statement &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(define lotsOftext  &amp;quot;This is a long text string. I am using a  &lt;br /&gt;
                     define statement to avoid having to type  &lt;br /&gt;
                     it repeatedly.&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This introduces another aspect of text strings: If text is too long fit on a single line, you may enter it on several lines.  Multiple white-space (spaces, tabs, and newlines) gets converted to a single space, so the text above ends up with just one space between the words on each line.  If you want multiple spaces, enter them as underbars, &amp;#039;_&amp;#039;.  These are converted to spaces in the string, but are not compacted. &lt;br /&gt;
&lt;br /&gt;
To include a &amp;#039;_&amp;#039; in text, type &amp;#039;\_&amp;#039;, where &amp;#039;\&amp;#039; is the escape character. Explicit newlines are entered just as in C: &amp;#039;\n&amp;#039;.  A CR/LF pair is entered as &amp;#039;\r&amp;#039; (the &amp;#039;\r&amp;#039; should be used in place of &amp;#039;\n&amp;#039; in all strings destined for a file).  Characters which are not on the keyboard, but are defined in a font (such as the Sierra symbol in the menubar) can be included in the string by preceding the two-digit hex value of the character with the &amp;#039;\&amp;#039;. Thus, &amp;quot;This is the Sierra symbol: \01&amp;quot; would put the value 1 at the end of the string, and this character in the font is the Sierra symbol.&lt;br /&gt;
&lt;br /&gt;
The maximum length of a text string is 2000 bytes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Word-strings: ===&lt;br /&gt;
&lt;br /&gt;
Word-strings are used to represent templates for user input in Said statements.  A word-string is a string enclosed in single quotes which contains meta-characters describing the content of a sentence.  The meta-characters and their meanings are described in the separate Vocabulary documentation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(if (Said &amp;#039;give/pirate/gold coins&amp;lt;#&amp;#039; @howMany) &lt;br /&gt;
      (Print &amp;quot;Get lost creep.&amp;quot;)&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As with text strings, identical strings are stored only once.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Characters: ===&lt;br /&gt;
&lt;br /&gt;
Characters are single ASCII characters, and are denoted by preceding the character with the reverse single quote (&amp;quot;tick&amp;quot;) character:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
`A   represents uppercase A and &lt;br /&gt;
`?   represents the question mark &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several character sequences represent special key combinations: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
`^a  represents ctrl-A &lt;br /&gt;
`@b  represents alt-B &lt;br /&gt;
`#4  represents the F4 key &lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;br /&amp;gt; Literal selectors: ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, as in the code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(cast eachElementDo: #showSelf:)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you want to send the value of selector rather than use the selector as the start of another message to an object (these terms will be described in Object Oriented Programming in Script).  Preceding the selector with a &amp;#039;#&amp;#039; produces the literal value of the selector rather than using it as a message.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[The Script Programming Language | Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: left&amp;quot;&amp;gt;[[The Script Programming Language/Definitions | &amp;amp;lt; Previous: Definitions]]&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[The Script Programming Language/Primitive Procedures | Next: Primitive Procedures &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:SCI Documentation]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Introduction&amp;diff=8123</id>
		<title>The Script Programming Language/Introduction</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=The_Script_Programming_Language/Introduction&amp;diff=8123"/>
		<updated>2015-12-01T20:33:16Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[The Original SCI Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
Chapter: &lt;br /&gt;
[[The Script Programming Language/Introduction|1]] | &lt;br /&gt;
[[The Script Programming Language/Files|2]] | &lt;br /&gt;
[[The Script Programming Language/Definitions|3]] | &lt;br /&gt;
[[The Script Programming Language/Data Types and Variables|4]] | &lt;br /&gt;
[[The Script Programming Language/Primitive Procedures|5]] | &lt;br /&gt;
[[The Script Programming Language/Control Flow|6]] | &lt;br /&gt;
[[The Script Programming Language/Procedures|7]] | &lt;br /&gt;
[[The Script Programming Language/Using SC|8]] | &lt;br /&gt;
[[The Script Programming Language/Index|Index]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-size: 22pt&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;Author: [[Jeff Stephenson]]&amp;#039;&amp;#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
The Script adventure game language is an object-oriented language with a Lisp-like syntax. It is compiled by the sc compiler into the pseudo-code which is used by the interpreter, sci.&lt;br /&gt;
&lt;br /&gt;
We will begin our discussion of the language with its basic Lisp-like characteristics, then go on to the object-oriented parts of the language.&lt;br /&gt;
&lt;br /&gt;
As is Lisp, Script is based on parenthesized expressions which return values. An expression is of the form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(procedure [parameter parameter ...]).&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters to a procedure may themselves be expressions to be evaluated, and may be nested until you lose track of the parentheses.&lt;br /&gt;
&lt;br /&gt;
Unlike Lisp, the procedure itself may NOT be the result of an evaluation. An example of an expression is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(+ (- y 2) (/ x 3))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which would be written in infix notation as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(y - 2) + (x / 3)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All expressions are guaranteed to be evaluated from left to right. Thus,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;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;
(= x 4)&lt;br /&gt;
(= y (/ (+= x 4) (/= x 2)))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will result in y = 2 and x = 4.&lt;br /&gt;
&lt;br /&gt;
Comments in Script begin with a semi-colon, &amp;#039;;&amp;#039;, and continue to the end of the line.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
;Notes&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[The Script Programming Language | Table of Contents]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: left&amp;quot;&amp;gt;[[The Script Programming Language |&amp;amp;lt; Previous: Table of Contents]]&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[The Script Programming Language/Files|Next: Files &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:SCI Documentation]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=SCI_Tutorials&amp;diff=7988</id>
		<title>SCI Tutorials</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=SCI_Tutorials&amp;diff=7988"/>
		<updated>2015-11-28T22:28:41Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are the tutorials that we currently have available. They cover a beginner&amp;#039;s getting started level to more advanced topics. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
* [[SCI Studio Tutorial 1|Brian Provinciano&amp;#039;s SCI Studio Tutorial 1]]&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[SCI Studio Tutorial 2|Brian Provinciano&amp;#039;s SCI Studio Tutorial 2]]&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Advanced SCI Tutorials|Phil Fortier&amp;#039;s Advanced SCI Tutorials]]&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[SCI Point and Click Tutorial|Cloudee1&amp;#039;s SCI Point and Click Tutorial]]&lt;br /&gt;
* [[Adding Sound Support|Brandon Blume&amp;#039;s Adding Sound Support]]&lt;br /&gt;
* [[Official SCI Documentation]]&lt;br /&gt;
* [http://scicompanion.com/Documentation/index.html SCI Companion Documentation]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[SCI_Studio_Tutorial 1|Next: Brian Provinciano&amp;#039;s SCI Studio Tutorial 1 &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7987</id>
		<title>Official SCI Documentation</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7987"/>
		<updated>2015-11-28T20:03:35Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Media:SCRIPT.pdf|The Script Programming Language]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:KERNEL.pdf|SCI Kernel Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:OBJECT.pdf|Object Oriented Programming in Script]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:CLASS.pdf|Script Classes for Adventure Games]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:NLPDOC.pdf|SCI Parser Programmer&amp;#039;s Reference]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Run_Time_System_Changes.pdf|Run Time System Changes]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:SCI_Changes_&amp;amp;_Updates.pdf|SCI Changes &amp;amp; Updates]]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7986</id>
		<title>Official SCI Documentation</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7986"/>
		<updated>2015-11-28T20:03:11Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Media:SCRIPT.pdf|The Script Programming Language]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:KERNEL.pdf|SCI Kernel Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:OBJECT.pdf|Object Oriented Programming in Script]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:CLASS.pdf|Script Classes for Adventure Games]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:NLPDOC.pdf|SCI Parser Programmer&amp;#039;s Reference]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Run_Time_System_Changes.pdf|Run Time System Changes]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:SCI_Changes_&amp;amp;_Updates.pdf.pdf|SCI Changes &amp;amp; Updates]]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7985</id>
		<title>Official SCI Documentation</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7985"/>
		<updated>2015-11-28T20:02:44Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Media:SCRIPT.pdf|The Script Programming Language]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:KERNEL.pdf|SCI Kernel Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:OBJECT.pdf|Object Oriented Programming in Script]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:CLASS.pdf|Script Classes for Adventure Games]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:NLPDOC.pdf|SCI Parser Programmer&amp;#039;s Reference]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:Run_Time_System_Changes.pdf|Run Time System Changes]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:SCI_Changes_%26_Updates.pdf.pdf|SCI Changes &amp;amp; Updates]]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=File:SCI_Changes_%26_Updates.pdf&amp;diff=7984</id>
		<title>File:SCI Changes &amp; Updates.pdf</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=File:SCI_Changes_%26_Updates.pdf&amp;diff=7984"/>
		<updated>2015-11-28T20:02:04Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: SCI Changes &amp;amp; Updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SCI Changes &amp;amp; Updates&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=File:Run_Time_System_Changes.pdf&amp;diff=7983</id>
		<title>File:Run Time System Changes.pdf</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=File:Run_Time_System_Changes.pdf&amp;diff=7983"/>
		<updated>2015-11-28T20:00:04Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: Run Time System Changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Run Time System Changes&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7982</id>
		<title>Official SCI Documentation</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7982"/>
		<updated>2015-11-28T18:30:26Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Media:SCRIPT.pdf|The Script Programming Language]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:KERNEL.pdf|SCI Kernel Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:OBJECT.pdf|Object Oriented Programming in Script]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:CLASS.pdf|Script Classes for Adventure Games]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:NLPDOC.pdf|SCI Parser Programmer&amp;#039;s Reference]]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=File:NLPDOC.pdf&amp;diff=7981</id>
		<title>File:NLPDOC.pdf</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=File:NLPDOC.pdf&amp;diff=7981"/>
		<updated>2015-11-28T18:29:20Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: SCI Parser Programmer&amp;#039;s Reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SCI Parser Programmer&amp;#039;s Reference&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=File:CLASS.pdf&amp;diff=7980</id>
		<title>File:CLASS.pdf</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=File:CLASS.pdf&amp;diff=7980"/>
		<updated>2015-11-28T11:02:03Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: Script Classes for Adventure Games&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Script Classes for Adventure Games&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7979</id>
		<title>Official SCI Documentation</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7979"/>
		<updated>2015-11-28T11:01:31Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Media:SCRIPT.pdf|The Script Programming Language]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:KERNEL.pdf|SCI Kernel Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:OBJECT.pdf|Object Oriented Programming in Script]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:CLASS.pdf|Script Classes for Adventure Games]]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7978</id>
		<title>Official SCI Documentation</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Official_SCI_Documentation&amp;diff=7978"/>
		<updated>2015-11-28T09:33:25Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: Adding Official SCI Documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Media:SCRIPT.pdf|The Script Programming Language]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:KERNEL.pdf|SCI Kernel Documentation]]&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Media:OBJECT.pdf|Object Oriented Programming in Script]]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=File:KERNEL.pdf&amp;diff=7977</id>
		<title>File:KERNEL.pdf</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=File:KERNEL.pdf&amp;diff=7977"/>
		<updated>2015-11-28T09:24:55Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: SCI Kernel Documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SCI Kernel Documentation&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=File:OBJECT.pdf&amp;diff=7976</id>
		<title>File:OBJECT.pdf</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=File:OBJECT.pdf&amp;diff=7976"/>
		<updated>2015-11-28T09:22:54Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: Object Oriented Programming in Script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Object Oriented Programming in Script&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=File:SCRIPT.pdf&amp;diff=7975</id>
		<title>File:SCRIPT.pdf</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=File:SCRIPT.pdf&amp;diff=7975"/>
		<updated>2015-11-28T09:21:46Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: The Script Programming Language&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Script Programming Language&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=SCI_Tutorials&amp;diff=7974</id>
		<title>SCI Tutorials</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=SCI_Tutorials&amp;diff=7974"/>
		<updated>2015-11-28T09:20:14Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are the tutorials that we currently have available. They cover a beginner&amp;#039;s getting started level to more advanced topics. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
* [[SCI Studio Tutorial 1|Brian Provinciano&amp;#039;s SCI Studio Tutorial 1]]&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[SCI Studio Tutorial 2|Brian Provinciano&amp;#039;s SCI Studio Tutorial 2]]&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[Advanced SCI Tutorials|Phil Fortier&amp;#039;s Advanced SCI Tutorials]]&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[SCI Point and Click Tutorial|Cloudee1&amp;#039;s SCI Point and Click Tutorial]]&lt;br /&gt;
* [[Adding Sound Support|Brandon Blume&amp;#039;s Adding Sound Support]]&lt;br /&gt;
* [[Official SCI Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;float: right&amp;quot;&amp;gt;[[SCI_Studio_Tutorial 1|Next: Brian Provinciano&amp;#039;s SCI Studio Tutorial 1 &amp;amp;gt;]]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Fonts&amp;diff=7893</id>
		<title>Fonts</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Fonts&amp;diff=7893"/>
		<updated>2015-07-05T20:03:56Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Sierra System ==&lt;br /&gt;
[[File:Sierra_System.png]]&lt;br /&gt;
&lt;br /&gt;
== Sierra Serif ==&lt;br /&gt;
&lt;br /&gt;
== Sierra Sans ==&lt;br /&gt;
&lt;br /&gt;
== Sierra Small ==&lt;br /&gt;
&lt;br /&gt;
== Heir Serif Bold ==&lt;br /&gt;
&lt;br /&gt;
== Wilco Serif ==&lt;br /&gt;
&lt;br /&gt;
== Sierra Debug ==&lt;br /&gt;
&lt;br /&gt;
== Sierra Large ==&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=File:Sierra_System.png&amp;diff=7892</id>
		<title>File:Sierra System.png</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=File:Sierra_System.png&amp;diff=7892"/>
		<updated>2015-07-05T20:02:45Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Fonts&amp;diff=7891</id>
		<title>Fonts</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Fonts&amp;diff=7891"/>
		<updated>2015-07-04T08:10:50Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Sierra System ==&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Sierra Serif ==&lt;br /&gt;
&lt;br /&gt;
== Sierra Sans ==&lt;br /&gt;
&lt;br /&gt;
== Sierra Small ==&lt;br /&gt;
&lt;br /&gt;
== Heir Serif Bold ==&lt;br /&gt;
&lt;br /&gt;
== Wilco Serif ==&lt;br /&gt;
&lt;br /&gt;
== Sierra Debug ==&lt;br /&gt;
&lt;br /&gt;
== Sierra Large ==&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=Fonts&amp;diff=7890</id>
		<title>Fonts</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=Fonts&amp;diff=7890"/>
		<updated>2015-07-04T08:05:16Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: Created page with &amp;quot; == Sierra System == File:Example.jpg&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Sierra System ==&lt;br /&gt;
[[File:Example.jpg]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
	<entry>
		<id>http://sciwiki.sierrahelp.com/index.php?title=SCI_Companion&amp;diff=448</id>
		<title>SCI Companion</title>
		<link rel="alternate" type="text/html" href="http://sciwiki.sierrahelp.com/index.php?title=SCI_Companion&amp;diff=448"/>
		<updated>2011-12-15T17:41:13Z</updated>

		<summary type="html">&lt;p&gt;Omer Mor: /* SCI Companion */ Added link to SCI Companion source code repository on github&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Integrated Development Environments==&lt;br /&gt;
&lt;br /&gt;
There are two IDEs publicly available for SCI development. The first is SCI Studio, by Brian Provinciano and the second, SCI Companion, by Phil Fortier. Both original authors have since abandoned any further development.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;SCI Companion&amp;lt;/div&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;[[File:SCICompanion.png|SCICompanion.png]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Complete editor for EGA SCI games. Inspired by SCIStudio. You can edit pics, views, script source code, text resources, cursors, fonts, the main vocab file, even create new games. &lt;br /&gt;
&lt;br /&gt;
Download from the [http://www.mtnphil.com/Games/SCIComp.html SCI Companion homepage] or download from here:&lt;br /&gt;
&lt;br /&gt;
* [[Image:ZIP.GIF|ZIP File]][[SCI:SCITools/SCIComp.zip|SCICompanion Version 2.1.0.5 with help file]]&amp;lt;span class=&amp;quot;DLInfo&amp;quot;&amp;gt; (ZIP file) [2.50 MB]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Source Code is available here:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/OmerMor/SciCompanion SCI Companion Repository on GitHub]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;SCI Studio 3&amp;lt;/div&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;[[File:SCI-Studio3.png| SCI Studio 3]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Brian Provinciano&amp;#039;s original tool for creating EGA SCI games. Home page no longer exists. SCI Studio 3 is that last release version of his IDE, but it has certain stability issues. Brian Provinciano was developing a version of SCI Studio that could open and create the SCI1 VGA games before he abandoned all work on Studio. &lt;br /&gt;
&lt;br /&gt;
* [[Image:ZIP.GIF|ZIP File]][[SCI:SCITools/SCIStudio3/SCI_Studio_30_(30129).zip|SCI Studio 3.0]]&amp;lt;span class=&amp;quot;DLInfo&amp;quot;&amp;gt; (ZIP file) [1.70 MB]&amp;lt;/span&amp;gt;&lt;br /&gt;
** [[Image:ZIP.GIF|ZIP File]][[SCI:SCITools/SCIStudio3/SCI_Studio_30_Source(20030316).zip|CI Studio 3.0 Source]]&amp;lt;span class=&amp;quot;DLInfo&amp;quot;&amp;gt; (ZIP file) [510 KB]&amp;lt;/span&amp;gt;&lt;br /&gt;
* [[Image:ZIP.GIF|ZIP File]][[SCI:SCITools/SCIStudio3/SCI_Studio_30_Template_Game.zip|SCI Studio 3 Template Game]]&amp;lt;span class=&amp;quot;DLInfo&amp;quot;&amp;gt; (ZIP file) [156 KB]&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;!--* [[Image:ZIP.GIF|ZIP File]][[SCI:SCITools/SCIStudio3/SCI_Studio_3_Help_Files.zip|SCI Studio 3 Help Files]]&amp;lt;span class=&amp;quot;DLInfo&amp;quot;&amp;gt; (ZIP file) [405 KB]&amp;lt;/span&amp;gt;&lt;br /&gt;
* [[Image:ZIP.GIF|ZIP File]][[SCI:SCITools/SCIStudio3/SCI_Studio_3_Tutorials.zip|SCI Studio 3 Tutorials]]&amp;lt;span class=&amp;quot;DLInfo&amp;quot;&amp;gt; (ZIP file) [629 KB]&amp;lt;/span&amp;gt;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The original project&amp;#039;s site no longer exists, however, the source of SCI Studio is available and has been placed on SVN at SourceForge. The current SCI Studio&amp;#039;s site on SourceForge can be found at http://scistudio.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;div align=&amp;quot;center&amp;quot;&amp;gt;SCI Studio 4 (VGA)&amp;lt;/div&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Brian Provinciano&amp;#039;s unfinished work to add support for the SCI VGA games.&lt;br /&gt;
&lt;br /&gt;
* [[Image:ZIP.GIF|ZIP File]][[SCI:SCITools/SCI_Studio_VGA.zip|SCI Studio 4 (VGA)]]&amp;lt;span class=&amp;quot;DLInfo&amp;quot;&amp;gt; (ZIP file) [1.63 MB]&amp;lt;/span&amp;gt;&lt;br /&gt;
** [[Image:ZIP.GIF|ZIP File]][[SCI:SCITools/SCI_Studio_VGA_Development_Source_Code.zip|SCI Studio 4 (VGA) Source]]&amp;lt;span class=&amp;quot;DLInfo&amp;quot;&amp;gt; (ZIP file) [3.02 MB]&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
[[Category:SCI Tools]]&lt;/div&gt;</summary>
		<author><name>Omer Mor</name></author>
	</entry>
</feed>