Bam Bam
11-01-2006, 08:31 PM
Indenting will be two spaces per level. You can indent by selecting text in SCAR and pressing Ctrl+Shift+U and Ctrl+Shift+I.
Margins will be set to 80 characters. Try not to make too long lines.
The begin statement appears on its own line. The end statement always
matches the begin statement by columns.
Example:
http://i12.tinypic.com/4l6jtj6.gif
Do not combine two or more statements on a single line. Write each on its own line.
Use semicolons at the end of the lines where appropriate. SCAR allows lines without semicolons but you should use them everywhere, except after var, begin, then, else repeat, do and before else.
Use spaces after commas and arithmetical signs.
Example:
http://i6.tinypic.com/5xysgm0.gif
There shall never be white space between an open parenthesis and the next character.
Example:
http://i10.tinypic.com/5xzdezt.gif
Object Pascal language reserved words and key words shall always be completely lowercase. Never capitalize words that SCAR displays in bold. It's completely unnecessary and looks ugly!
Routine names shall always begin with a capital letter and be camel-capped for readability.
Example:
http://i6.tinypic.com/4tabotf.gif
Routines shall be given names meaningful to their content. Routine name DoStuffWithSyAndSy is not meaningful, but name OutputProgressReport is.
Where possible, procedure and function formal parameters of the same type shall be combined into one statement
Example:
http://i18.tinypic.com/53slime.gif
All formal procedure and function parameter names will be meaningful to their purpose.
All functions should always return some value. Do not rely on SCAR initializing procedure return value automatically!
Variables will be given names meaningful to their purpose. That includes local and loop control variables, although in this case single character names are acceptable.
Boolean variable names must be descriptive enough so that their meanings of True and False values will be clear.
Variable declarations start in next line after var statement and are indented.
Example:
http://i15.tinypic.com/4tf19bp.gif
Use of global variables is discouraged. However, they may be used when necessary. Global variable naming rules are as follow:
Forms and controls are prefixed with their individual prefixes. Examples: frmMainForm, lblUser, txtPassword, imgPreview etc.
DTMs will be marked with dtm prefix as in dtmFishingSpot.
Character sets will be marked with chr prefix as in chrChatChars.
Bitmaps will be marked with bmp prefix as in bmpFishingNet.
Include global variables will be marked with g prefix then include initials as in gOsiStartTime.
Normal global variables will be marked with g prefix as in gNumFishCaught.
Type names that are reserved words shall be completely lowercase as in string. For other variable names, the first letter shall be uppercase, and the rest shall be camel-capped for clarity as in Integer.
The most likely case to execute in an if/then/else statement shall be placed in the then clause, with less likely cases residing in the else clause(s). This improves performance as well as readability.
If multiple conditions are being tested in an if statement, conditions should be arrange from left to right in order of least to most computation intensive. If condition statement is complex, replace it with function or Boolean variable with a meaningful name. This improves readability and makes code self-documenting.
Use of informational file header is encouraged for all script and include files.
Use Script > Script Properties from SCAR menu to enter script information.
These standards ensures readability of your code and enables easier maintaining of scripts written by other people.
[Source = http://kaitnieks.com/scar/scriptingsta/ ]
Margins will be set to 80 characters. Try not to make too long lines.
The begin statement appears on its own line. The end statement always
matches the begin statement by columns.
Example:
http://i12.tinypic.com/4l6jtj6.gif
Do not combine two or more statements on a single line. Write each on its own line.
Use semicolons at the end of the lines where appropriate. SCAR allows lines without semicolons but you should use them everywhere, except after var, begin, then, else repeat, do and before else.
Use spaces after commas and arithmetical signs.
Example:
http://i6.tinypic.com/5xysgm0.gif
There shall never be white space between an open parenthesis and the next character.
Example:
http://i10.tinypic.com/5xzdezt.gif
Object Pascal language reserved words and key words shall always be completely lowercase. Never capitalize words that SCAR displays in bold. It's completely unnecessary and looks ugly!
Routine names shall always begin with a capital letter and be camel-capped for readability.
Example:
http://i6.tinypic.com/4tabotf.gif
Routines shall be given names meaningful to their content. Routine name DoStuffWithSyAndSy is not meaningful, but name OutputProgressReport is.
Where possible, procedure and function formal parameters of the same type shall be combined into one statement
Example:
http://i18.tinypic.com/53slime.gif
All formal procedure and function parameter names will be meaningful to their purpose.
All functions should always return some value. Do not rely on SCAR initializing procedure return value automatically!
Variables will be given names meaningful to their purpose. That includes local and loop control variables, although in this case single character names are acceptable.
Boolean variable names must be descriptive enough so that their meanings of True and False values will be clear.
Variable declarations start in next line after var statement and are indented.
Example:
http://i15.tinypic.com/4tf19bp.gif
Use of global variables is discouraged. However, they may be used when necessary. Global variable naming rules are as follow:
Forms and controls are prefixed with their individual prefixes. Examples: frmMainForm, lblUser, txtPassword, imgPreview etc.
DTMs will be marked with dtm prefix as in dtmFishingSpot.
Character sets will be marked with chr prefix as in chrChatChars.
Bitmaps will be marked with bmp prefix as in bmpFishingNet.
Include global variables will be marked with g prefix then include initials as in gOsiStartTime.
Normal global variables will be marked with g prefix as in gNumFishCaught.
Type names that are reserved words shall be completely lowercase as in string. For other variable names, the first letter shall be uppercase, and the rest shall be camel-capped for clarity as in Integer.
The most likely case to execute in an if/then/else statement shall be placed in the then clause, with less likely cases residing in the else clause(s). This improves performance as well as readability.
If multiple conditions are being tested in an if statement, conditions should be arrange from left to right in order of least to most computation intensive. If condition statement is complex, replace it with function or Boolean variable with a meaningful name. This improves readability and makes code self-documenting.
Use of informational file header is encouraged for all script and include files.
Use Script > Script Properties from SCAR menu to enter script information.
These standards ensures readability of your code and enables easier maintaining of scripts written by other people.
[Source = http://kaitnieks.com/scar/scriptingsta/ ]