const/isconst documentation

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6586 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lucas GAUTHERON
2011-08-16 23:41:26 +00:00
parent 4fab21985b
commit ef0550c758
2 changed files with 74 additions and 18 deletions
+10
View File
@@ -214,6 +214,10 @@ docident [checkalias] [Determines if the argument given is an existing alias or
docargument [A] [the alias to check for] [] [0];
docexample [hello = ""; echo (checkalias hello)] [Output: 1];
docexample [echo (checkalias oMgThIsAlIaSpRoLlYdOeSnTeXiSt)] [Output: 0];
docident [isconst] [Determines if the argument given is a constant or not.];
docargument [A] [the alias to check for] [] [0];
docexample [const hello ""; echo (isconst hello)] [Output: 1];
docexample [hello = value; echo (isconst hello)] [Output: 0];
docident [checkinit] [Ensures the initialization of an alias.];
docargument [A] [the alias to check for] [] [0];
docargument [B] [the optional block of code to ensure that the alias contains] [] [0];
@@ -271,6 +275,12 @@ docargument [N] [the name of the alias] [string, must not contain '$'] [0];
docargument [A] [the commands] [string] [0];
docexample [alias myalias [ echo "hello world"; alias myalias [ echo "I already said hello" ] ]] [It is possible to re-bind an alias, even during its evaluation.];
docexample [test = [ echo "successful" ]] [There is also the shorthand version of defining an alias via the "="-sign.];
docident [const] [Set an alias as a constant.];
docargument [N] [the name of the alias] [string, must not contain '$'] [0];
docargument [A] [the value (optional)] [string] [0];
docexample [myalias = myvalue; const myalias;] [Set "myalias" value to "myvalue" then "lock" it as a constant.];
docexample [const myalias myvalue;] [You can directly set a value for your alias when you define it as a constant.];
docexample [const myalias myvalue; myalias = anothervalue;] [Assigning a value to a const will throw you an error. Output: myalias is already defined as a constant];
docident [attack] [Fires the current weapon.];
docremark [default: left mouse button];
docident [autogetmap] [Determines if the current played map should be automatically downloaded if it is not available locally.];
+64 -18
View File
@@ -827,6 +827,50 @@
<identifierReference identifier="getvar"/>
</references>
</command>
<command name="alias">
<description>Binds a name to commands.</description>
<arguments>
<argument token="N" description="the name of the alias" valueNotes="string, must not contain '$'"/>
<argument token="A" description="the commands" valueNotes="string"/>
</arguments>
<examples>
<example>
<code><![CDATA[alias myalias [ echo "hello world"; alias myalias [ echo "I already said hello" ] ]]]></code>
<explanation>It is possible to re-bind an alias, even during its evaluation.</explanation>
</example>
<example>
<code><![CDATA[test = [ echo "successful" ]]]></code>
<explanation>There is also the shorthand version of defining an alias via the "="-sign.</explanation>
</example>
</examples>
</command>
<command name="const">
<description>Set an alias as a constant.</description>
<remarks>
<remark>A constant cannot be redefined : its value cannot be changed.</remark>
<remark>To get rid of a constant, use delalias</remark>
</remarks>
<arguments>
<argument token="N" description="the name of the alias" valueNotes="string, must not contain '$'"/>
<argument token="A" description="the value" valueNotes="string (optional)"/>
</arguments>
<examples>
<example>
<code><![CDATA[myalias = myvalue; const myalias;]]></code>
<explanation>Set "myalias" value to "myvalue" then "lock" it as a constant.</explanation>
</example>
<example>
<code><![CDATA[const myalias myvalue;]]></code>
<explanation>You can directly set a value for your alias when you define it as a constant.</explanation>
</example>
<example>
<code><![CDATA[const myalias myvalue; myalias = anothervalue;]]></code>
<explanation>Assigning a value to a const will throw you an error. Output: myalias is already defined as a constant</explanation>
</example>
</examples>
</command>
<command name="checkalias">
<description>Determines if the argument given is an existing alias or not.</description>
@@ -848,6 +892,26 @@
<identifierReference identifier="aliasinit"/>
</references>
</command>
<command name="isconst">
<description>Determines if the argument given is a constant or not.</description>
<examples>
<example>
<code><![CDATA[const hello ""; echo (isconst hello)]]></code>
<explanation>Output: 1</explanation>
</example>
<example>
<code><![CDATA[hello = value; echo (isconst hello)]]></code>
<explanation>Output: 0</explanation>
</example>
</examples>
<arguments>
<argument token="A" description="the alias to check for"/>
</arguments>
<references>
<identifierReference identifier="const"/>
</references>
</command>
<command name="checkinit">
<description>Ensures the initialization of an alias.</description>
@@ -1461,24 +1525,6 @@ echo foo
</arguments>
</command>
<command name="alias">
<description>Binds a name to commands.</description>
<arguments>
<argument token="N" description="the name of the alias" valueNotes="string, must not contain '$'"/>
<argument token="A" description="the commands" valueNotes="string"/>
</arguments>
<examples>
<example>
<code><![CDATA[alias myalias [ echo "hello world"; alias myalias [ echo "I already said hello" ] ]]]></code>
<explanation>It is possible to re-bind an alias, even during its evaluation.</explanation>
</example>
<example>
<code><![CDATA[test = [ echo "successful" ]]]></code>
<explanation>There is also the shorthand version of defining an alias via the "="-sign.</explanation>
</example>
</examples>
</command>
<command name="quit">
<description>Quits the game without asking.</description>
</command>