Entering Code into the Wiki

From SCI Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

For constancy through out the Wiki, whenever entering SCI code into the Wiki, please format any code like this:

<div class="CodeBlockHeader">Code:</div>
<syntaxhighlight lang="sci" class="cs">code goes here.</syntaxhighlight>

Which will result in this:

Code:
code goes here.

Syntax highlighting will automatically be added:

Code:
/******************************************************************************
 SCI Template Game
 By Brian Provinciano
 ******************************************************************************
 rev.sc
 Contains a cycle class for reverse animation. 
 ******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script REV_SCRIPT)
/******************************************************************************/
(use "cycle")
/******************************************************************************/
(class Rev of Cycle
	(properties
		client 0
		caller 0
		cycleDir cdBACKWARD
		cycleCnt 0
		completed 0
	)
	(method (doit)
		(var nCel)
		= nCel (self:nextCel)
		(if(< nCel 0)
		    (self:cycleDone())
		)(else
			(send client:cel(nCel))
		)
	)
	(method (cycleDone)
		(send client:cel( (send client:lastCel) ) )
	)
)
/******************************************************************************/

You use it in lieu of 'pre' tags. Because it acts like <pre> tags it will preserve the code's formatting without having to add nonbreaking spaces (&nbsp;) or line breaks tags (<br />).

This will make the code much more readable while maintaining/editing it. Other language syntax highlighting can be used if the language is changed in the code in the syntaxhighlight tag. For example, to use C++ highlighting you would change it to:

<syntaxhighlight lang="cpp">

For a list of other language codes, see this table.

As usual, you can experiment with it on the Test page.