Difference between revisions of "Help:Editing"

From SphereWiki
Jump to: navigation, search
(Created page with 'For standard wiki editing help, try [http://www.mediawiki.org/wiki/Help:Editing_pages MediaWiki's Editing Pages] help guide. In addition to the standard wiki formatting techniqu...')
 
Line 6: Line 6:
 
==spherescript==
 
==spherescript==
  
The <spherescript> tag can be used to easily embed SphereScript code into a wiki page without having to cover it with wiki/html formatting tabs. There are a few option attributes which can be set to customize the output of the tag. The full syntax of the tag along with the default settings for each attribute, is:
+
The <spherescript> tag can be used to easily embed SphereScript code into a wiki page without having to cover it with wiki/html formatting tags. There are a few option attributes which can be set to customize the output of the tag. The full syntax of the tag along with the default settings for each attribute, is:
  
  
<tt>&lt;spherescript color="darkblue" tabs="4" mono="1"&gt; '' script '' &lt;/spherescript&gt;</tt>
+
<tt>&lt;spherescript color="darkblue" mono="1" format="1" tabs="4"&gt; '' script '' &lt;/spherescript&gt;</tt>
  
  
Line 17: Line 17:
 
| color || What colour font to use.
 
| color || What colour font to use.
 
|-
 
|-
| tabs || How many spaces to convert tabs into.
+
| mono || Whether or not to use a fixed-width font
 
|-
 
|-
| mono || Whether or not to use a fixed-width font
+
| format || Whether or not to automatically format the script (currently, auto-indents)
 
|-
 
|-
 +
| tabs || How many spaces to output for each level of indentation.
 
|}
 
|}
  
Line 47: Line 48:
 
ENDIF
 
ENDIF
 
RETURN
 
RETURN
 +
</spherescript>
 +
 +
 +
If automatic formatting is enabled (which it is by default), then the script will be automatically indented, for example:
 +
&lt;spherescript&gt;
 +
[ITEMDEF i_testitem]
 +
ID=i_gold
 +
 +
ON=@DClick
 +
SRC.SYSMESSAGE You double-clicked the item...
 +
IF (&lt;SRC.STR&gt; &lt; 100)
 +
SRC.SYSMESSAGE but you don't have enough strength!
 +
ELSE
 +
SRC.SYSMESSAGE and you have enough strength!
 +
IF (&lt;SRC.INT&gt; &gt; 100)
 +
SRC.SYSMESSAGE You're pretty clever too!
 +
FORCHARS 18
 +
SAY We agree!
 +
ENDFOR
 +
ENDIF
 +
ENDIF
 +
&lt;/spherescript&gt;
 +
 +
Becomes:
 +
 +
<spherescript>
 +
[ITEMDEF i_testitem]
 +
ID=i_gold
 +
 +
ON=@DClick
 +
SRC.SYSMESSAGE You double-clicked the item...
 +
IF (<SRC.STR> < 100)
 +
SRC.SYSMESSAGE but you don't have enough strength!
 +
ELSE
 +
SRC.SYSMESSAGE and you have enough strength!
 +
IF (<SRC.INT> > 100)
 +
SRC.SYSMESSAGE You're pretty clever too!
 +
FORCHARS 18
 +
SAY We agree!
 +
ENDFOR
 +
ENDIF
 +
ENDIF
 
</spherescript>
 
</spherescript>

Revision as of 22:06, 8 June 2009

For standard wiki editing help, try MediaWiki's Editing Pages help guide.

In addition to the standard wiki formatting techniques, SphereWiki also uses some custom tags which are detailed below:


spherescript

The <spherescript> tag can be used to easily embed SphereScript code into a wiki page without having to cover it with wiki/html formatting tags. There are a few option attributes which can be set to customize the output of the tag. The full syntax of the tag along with the default settings for each attribute, is:


<spherescript color="darkblue" mono="1" format="1" tabs="4"> script </spherescript>


Attribute Meaning
color What colour font to use.
mono Whether or not to use a fixed-width font
format Whether or not to automatically format the script (currently, auto-indents)
tabs How many spaces to output for each level of indentation.


For example:

<spherescript>
[FUNCTION f_testscript]
LOCAL.TEST = <R100>
IF (<LOCAL.TEST> > 90)
	SRC.SYSMESSAGE You win this script!
ELSE
	SRC.SYSMESSAGE Unlucky, you lost!
ENDIF
RETURN
</spherescript>

Becomes:

[FUNCTION f_testscript]
LOCAL.TEST = <R100>
IF (<LOCAL.TEST> > 90)
    SRC.SYSMESSAGE You win this script!
ELSE
    SRC.SYSMESSAGE Unlucky, you lost!
ENDIF
RETURN


If automatic formatting is enabled (which it is by default), then the script will be automatically indented, for example:

<spherescript>
[ITEMDEF i_testitem]
ID=i_gold

ON=@DClick
SRC.SYSMESSAGE You double-clicked the item...
IF (<SRC.STR> < 100)
SRC.SYSMESSAGE but you don't have enough strength!
ELSE
SRC.SYSMESSAGE and you have enough strength!
IF (<SRC.INT> > 100)
SRC.SYSMESSAGE You're pretty clever too!
FORCHARS 18
SAY We agree!
ENDFOR
ENDIF
ENDIF
</spherescript>

Becomes:

[ITEMDEF i_testitem]
ID=i_gold

ON=@DClick
    SRC.SYSMESSAGE You double-clicked the item...
    IF (<SRC.STR> < 100)
        SRC.SYSMESSAGE but you don't have enough strength!
    ELSE
        SRC.SYSMESSAGE and you have enough strength!
        IF (<SRC.INT> > 100)
            SRC.SYSMESSAGE You're pretty clever too!
            FORCHARS 18
                SAY We agree!
            ENDFOR
        ENDIF
    ENDIF