This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
wiki:syntax [2019/03/07 15:57] – Karsten75 | wiki:syntax [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Formatting Syntax ====== | ||
- | ---- | + | [[doku> |
- | ====== abs ====== | + | ===== Basic Text Formatting |
- | abs(%%< | + | DokuWiki supports **bold**, //italic//, __underlined__ and '' |
- | ===== Description ===== | + | DokuWiki supports **bold**, //italic//, __underlined__ and '' |
+ | Of course you can **__//'' | ||
- | Calculates the absolute value of the item and pushes the result on the stack. | + | You can use < |
- | ===== Examples ===== | + | You can use < |
- | <code> | + | You can mark something as <del>deleted</del> as well. |
- | trace(abs(-1)) #prints ' | + | |
- | </code> | + | |
- | ---- | + | You can mark something as < |
+ | **Paragraphs** are created from blank lines. If you want to **force a newline** without a paragraph, you can use two backslashes followed by a whitespace or the end of line. | ||
- | ---- | + | This is some text with some linebreaks\\ Note that the |
+ | two backslashes are only recognized at the end of a line\\ | ||
+ | or followed by\\ a whitespace \\this happens without it. | ||
- | ====== acos ====== | + | This is some text with some linebreaks\\ Note that the |
+ | two backslashes are only recognized at the end of a line\\ | ||
+ | or followed by\\ a whitespace \\this happens without it. | ||
- | acos(-1) %%-> | + | You should use forced newlines only if really needed. |
- | ===== Description | + | ===== Links ===== |
- | Calculates the arccosine | + | DokuWiki supports multiple ways of creating links. |
- | ===== Examples ===== | + | ==== External |
- | < | + | External links are recognized automagically: |
- | trace(acos(-1)) #prints PI | + | |
- | </code> | + | |
- | ---- | + | DokuWiki supports multiple ways of creating links. External links are recognized |
+ | automagically: | ||
+ | link text as well: [[http:// | ||
+ | addresses like this one: < | ||
+ | ==== Internal ==== | ||
- | ---- | + | Internal links are created by using square brackets. You can either just give a [[pagename]] or use an additional [[pagename|link text]]. |
- | ====== add ====== | + | Internal links are created by using square brackets. You can either just give |
+ | a [[pagename]] or use an additional [[pagename|link text]]. | ||
- | 2 add (3) %%->%%five | + | [[doku>pagename|Wiki pagenames]] are converted to lowercase automatically, |
- | ===== Description ===== | + | You can use [[some: |
- | Adds two arguments together and pushes | + | You can use [[some: |
- | ===== Examples ===== | + | For details about namespaces see [[doku> |
- | < | + | Linking to a specific section is possible, too. Just add the section name behind a hash character as known from HTML. This links to [[syntax#internal|this Section]]. |
- | trace(add(21 21)) #prints 42 | + | |
- | </ | + | |
- | ---- | + | This links to [[syntax# |
+ | Notes: | ||
- | ---- | + | * Links to [[syntax|existing pages]] are shown in a different style from [[nonexisting]] ones. |
+ | * DokuWiki does not use [[wp> | ||
+ | * When a section' | ||
- | ====== and ====== | + | ==== Interwiki |
- | <-bool1 and (< | + | DokuWiki supports [[doku>Interwiki]] links. These are quick links to other Wikis. For example this is a link to Wikipedia' |
- | ===== Description ===== | + | DokuWiki supports [[doku> |
+ | For example this is a link to Wikipedia' | ||
- | Pops two items from the stack and treats them as TRUE/FALSE (0/1 or Boolean) values. If they are both TRUE, 1 is pushed to the stack. Otherwise, 0 is pushed to the stack. | + | ==== Windows Shares ==== |
- | ===== Examples ===== | + | Windows shares like [[\\server\share|this]] are recognized, too. Please note that these only make sense in a homogeneous user group like a corporate [[wp> |
- | < | + | Windows Shares like [[\\server\share|this]] |
- | if (1 and (true)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | ---- | + | Notes: |
- | + | * For security reasons direct browsing | |
- | ---- | + | * For Mozilla and Firefox it can be enabled through different workaround mentioned in the [[http:// |
- | + | <?php | |
- | ====== AppendStackToList ====== | + | /** |
- | + | * Customization of the english language file | |
- | AppendStackToList | + | * Copy only the strings that needs to be modified |
- | + | */ | |
- | ===== Description ===== | + | $lang[' |
- | + | ||
- | Adds all values on the stack to the end of a list. The order of the values will be reversed. | + | |
- | + | ||
- | Note that the stack will be empty after this call, so think before using it in functions. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | <code> | + | |
- | Split(" | + | |
- | Split(" | + | |
- | Trace(< | + | |
</ | </ | ||
- | ---- | + | ==== Image Links ==== |
+ | You can also use an image to link to another internal or external page by combining the syntax for links and [[# | ||
- | ---- | + | [[http:// |
- | ====== AppendToList ====== | + | [[http:// |
- | AppendToList( <-list <-var) | + | Please note: The image formatting is the only formatting syntax accepted in link names. |
- | ===== Description ===== | + | The whole [[# |
- | Adds a value to the end of a list. | + | ===== Footnotes ===== |
- | ===== Examples ===== | + | You can add footnotes ((This is a footnote)) by using double parentheses. |
- | < | + | You can add footnotes |
- | Split(" | + | |
- | Split(" | + | |
- | do (GetListCount(< | + | |
- | Trace (<-list I GetListElement) | + | |
- | loop | + | |
- | </ | + | |
- | ---- | + | ===== Sectioning ===== |
+ | You can use up to five different levels of headlines to structure your content. If you have more than three headlines, a table of contents is generated automatically -- this can be disabled by including the string ''< | ||
- | ---- | + | ==== Headline Level 3 ==== |
+ | === Headline Level 4 === | ||
+ | == Headline Level 5 == | ||
- | ====== | + | |
+ | | ||
+ | == Headline Level 5 == | ||
- | approximately(%%< | + | By using four or more dashes, you can make a horizontal line: |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Compares two floating point values and returns true if they are similar. | + | |
- | + | ||
- | Floating point imprecision makes comparing floats | + | |
- | + | ||
- | See [[http:%%// | + | |
- | + | ||
- | *Epsilon is defined as: The smallest value that a float can have different from zero. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (approximately(1.000001 1)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
---- | ---- | ||
+ | ===== Media Files ===== | ||
- | ---- | + | You can include external and internal [[doku> |
- | ====== asfloat ====== | + | Real size: {{wiki: |
- | asfloat (%%<-%%integer1) %%-> | + | Resize to given width: |
- | ===== Description ===== | + | Resize to given width and height((when the aspect ratio of the given width and height doesn' |
- | Converts an item on the stack to a floating point number and pushes it back onto the stack. | + | Resized external image: {{https:// |
- | ===== Examples ===== | + | Real size: {{wiki: |
+ | Resize to given width: | ||
+ | Resize to given width and height: {{wiki: | ||
+ | Resized external image: {{https:// | ||
- | < | ||
- | " | ||
- | </ | ||
- | ---- | + | By using left or right whitespaces you can choose the alignment. |
+ | {{ wiki: | ||
- | ---- | + | {{wiki: |
- | ====== asin ====== | + | {{ wiki: |
- | asin(%%<-%%one) %%-> | + | {{ wiki: |
+ | {{wiki: | ||
+ | {{ wiki: | ||
- | ===== Description ===== | + | Of course, you can add a title (displayed as a tooltip by most browsers), too. |
- | Calculates | + | {{ wiki: |
- | ===== Examples ===== | + | {{ wiki: |
- | < | + | For linking an image to another page see [[#Image Links]] above. |
- | trace(asin(1)) | + | |
- | </ | + | |
- | ---- | + | ==== Supported Media Formats ==== |
+ | DokuWiki can embed the following media formats directly. | ||
- | ---- | + | | Image | '' |
+ | | Video | '' | ||
+ | | Audio | '' | ||
+ | | Flash | '' | ||
- | ====== asint ====== | + | If you specify a filename that is not a supported media format, then it will be displayed as a link instead. |
- | asint (%%< | + | By adding ''? |
- | ===== Description ===== | + | {{wiki: |
- | Converts an item on the stack to an integer, and pushes it back to the stack. | + | {{wiki: |
- | ===== Examples ===== | + | ==== Fallback Formats |
- | < | + | Unfortunately not all browsers understand all video and audio formats. To mitigate the problem, you can upload your file in different formats for maximum browser compatibility. |
- | " | + | |
- | </ | + | |
- | ---- | + | For example consider this embedded mp4 video: |
+ | {{video.mp4|A funny video}} | ||
- | ---- | + | When you upload a '' |
- | ====== aslist ====== | + | Additionally DokuWiki supports a " |
- | To be supplied | + | ===== Lists ===== |
+ | Dokuwiki supports ordered and unordered lists. To create a list item, indent your text by two spaces and use a '' | ||
- | ---- | + | * This is a list |
+ | * The second item | ||
+ | * You may have different levels | ||
+ | * Another item | ||
- | + | | |
- | ---- | + | - Another item |
- | + | - Just use indention for deeper levels | |
- | ====== asstring ====== | + | - That's it |
- | + | ||
- | To be supplied | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== astable ====== | + | |
- | + | ||
- | To be supplied | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== atan ====== | + | |
- | + | ||
- | atan(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Calculates the arctangent of the input, returns the angle in radians. | + | |
- | + | ||
- | ===== Examples ===== | + | |
< | < | ||
- | trace(atan(1)) #prints PI/4 | + | * This is a list |
- | </ | + | * The second item |
+ | * You may have different levels | ||
+ | * Another item | ||
- | ---- | + | |
- | + | | |
- | + | - Just use indention for deeper levels | |
- | ---- | + | - That's it |
- | + | ||
- | ====== atan2 ====== | + | |
- | + | ||
- | atan2(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Computes and returns the angle of the point y/x in radians. The return value is between positive pi and negative pi. Note that the first parameter to atan2 is always the z coordinate. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(atan2(1 2)) #prints ' | + | |
</ | </ | ||
- | ---- | + | Also take a look at the [[doku> |
+ | ===== Text Conversions ===== | ||
- | ---- | + | DokuWiki can convert certain pre-defined characters or strings into images or other text or HTML. |
- | ====== avg2 ====== | + | The text to image conversion is mainly done for smileys. And the text to HTML conversion is used for typography replacements, |
- | avg2(%%< | + | ==== Text to Image Conversions ==== |
- | ===== Description ===== | + | DokuWiki converts commonly used [[wp> |
- | Computes the average of two numbers. | + | * 8-) %% 8-) %% |
+ | * 8-O %% 8-O %% | ||
+ | * :-( %% :-( %% | ||
+ | * :-) %% :-) %% | ||
+ | * =) %% =) %% | ||
+ | * :-/ %% :-/ %% | ||
+ | * :-\ %% :-\ %% | ||
+ | * :-? %% :-? %% | ||
+ | * :-D %% :-D %% | ||
+ | * :-P %% :-P %% | ||
+ | * :-O %% :-O %% | ||
+ | * :-X %% :-X %% | ||
+ | * :-| %% :-| %% | ||
+ | * ;-) %% ;-) %% | ||
+ | * ^_^ %% ^_^ %% | ||
+ | * m( %% m( %% | ||
+ | * :?: %% :?: %% | ||
+ | * :!: %% :!: %% | ||
+ | * LOL %% LOL %% | ||
+ | * FIXME %% FIXME %% | ||
+ | * DELETEME %% DELETEME %% | ||
- | ===== Examples ===== | + | ==== Text to HTML Conversions |
- | < | + | Typography: [[DokuWiki]] can convert simple text characters to their typographically correct entities. Here is an example |
- | 40 ->low | + | |
- | 44 ->high | + | |
- | avg2(< | + | |
- | trace(< | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== break ====== | + | |
- | + | ||
- | break | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Immediately exits the body of a ‘while/ | + | |
- | ===== Examples ===== | + | -> <- < |
+ | "He thought ' | ||
< | < | ||
- | do(5 0) | + | -> <- <-> => <= <=> >> << -- --- 640x480 |
- | if (I mod(2) eq0) #divide inner loop with modulo 2 and test if zero | + | "He thought ' |
- | break | + | |
- | endif | + | |
- | trace(I) | + | |
- | loop | + | |
</ | </ | ||
- | ---- | + | The same can be done to produce any kind of HTML, it just needs to be added to the [[doku> |
+ | There are three exceptions which do not come from that pattern file: multiplication entity (640x480), ' | ||
- | ---- | + | ===== Quoting ===== |
- | ====== ceil ====== | + | Some times you want to mark some text to show it's a reply or comment. You can use the following syntax: |
- | + | ||
- | ceil(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Takes one number from the stack, rounds | + | |
- | + | ||
- | ===== Examples ===== | + | |
< | < | ||
- | trace(ceil(4.2)) #prints ' | + | I think we should do it |
- | </ | + | |
- | ---- | + | > No we shouldn' |
+ | >> Well, I say we should | ||
- | ---- | + | > Really? |
- | ====== ClearStack ====== | + | >> Yes! |
- | ClearStack | + | >>> Then lets do it! |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Remove all items from the stack leaving it empty. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | <code> | + | |
- | 1 2 3 ClearStack #Stack is now empty | + | |
</ | </ | ||
- | ---- | + | I think we should do it |
+ | > No we shouldn' | ||
- | ---- | + | >> Well, I say we should |
- | ====== ClearTraceLog ====== | + | > Really? |
- | ClearTraceLog | + | >> Yes! |
- | ===== Description ===== | + | >>> |
- | Removes all messages from the debug window. | + | ===== Tables ===== |
- | ===== Examples ===== | + | DokuWiki supports a simple syntax to create tables. |
- | < | + | ^ Heading 1 ^ Heading 2 ^ Heading 3 ^ |
+ | | Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | | ||
+ | | Row 2 Col 1 | some colspan (note the double pipe) || | ||
+ | | Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3 | | ||
- | ClearTraceLog | + | Table rows have to start and end with a '' |
- | "Fresh Message" | + | |
- | </ | + | |
- | ---- | + | ^ Heading 1 ^ Heading 2 ^ Heading 3 ^ |
+ | | Row 1 Col 1 | Row 1 Col 2 | Row 1 Col 3 | | ||
+ | | Row 2 Col 1 | some colspan (note the double pipe) || | ||
+ | | Row 3 Col 1 | Row 3 Col 2 | Row 3 Col 3 | | ||
+ | To connect cells horizontally, | ||
- | ---- | + | Vertical tableheaders are possible, too. |
- | ====== Concat ====== | + | | ^ Heading 1 ^ Heading 2 ^ |
+ | ^ Heading 3 | Row 1 Col 2 | Row 1 Col 3 | | ||
+ | ^ Heading 4 | no colspan this time | | | ||
+ | ^ Heading 5 | Row 2 Col 2 | Row 2 Col 3 | | ||
- | Concat(“abc” “def”) %%-> | + | As you can see, it's the cell separator before a cell which decides about the formatting: |
- | ===== Description ===== | + | | ^ Heading 1 ^ Heading 2 ^ |
+ | ^ Heading 3 | Row 1 Col 2 | Row 1 Col 3 | | ||
+ | ^ Heading 4 | no colspan this time | | | ||
+ | ^ Heading 5 | Row 2 Col 2 | Row 2 Col 3 | | ||
- | Takes the first two items from the stack and concatenates them. | + | You can have rowspans (vertically connected cells) by adding '' |
- | ===== Examples ===== | + | ^ Heading 1 ^ Heading 2 ^ Heading 3 ^ |
+ | | Row 1 Col 1 | this cell spans vertically | Row 1 Col 3 | | ||
+ | | Row 2 Col 1 | ::: | Row 2 Col 3 | | ||
+ | | Row 3 Col 1 | ::: | Row 2 Col 3 | | ||
- | < | + | Apart from the rowspan syntax those cells should not contain anything else. |
- | Trace(Concat(" | + | |
- | </ | + | |
- | ---- | + | ^ Heading 1 ^ Heading 2 ^ Heading 3 ^ |
+ | | Row 1 Col 1 | this cell spans vertically | Row 1 Col 3 | | ||
+ | | Row 2 Col 1 | ::: | Row 2 Col 3 | | ||
+ | | Row 3 Col 1 | ::: | Row 2 Col 3 | | ||
+ | You can align the table contents, too. Just add at least two whitespaces at the opposite end of your text: Add two spaces on the left to align right, two spaces on the right to align left and two spaces at least at both ends for centered text. | ||
- | ---- | + | ^ Table with alignment |
+ | | | ||
+ | |left | | ||
+ | | xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx | | ||
- | ====== CopyList ====== | + | This is how it looks in the source: |
- | CopyList (%%< | + | ^ Table with alignment |
+ | | | ||
+ | |left | | ||
+ | | xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx | | ||
- | ===== Description ===== | + | Note: Vertical alignment is not supported. |
- | Creates a copy of a list with the same contents. Note that if the list contains other lists, they will not be copied - for that you need [[DeepCopyList | DeepCopyList]]. See [[Copy vs Deep Copy | Copy vs Deep Copy]] for more info. | + | ===== No Formatting ===== |
- | ===== Examples ===== | + | If you need to display text exactly like it is typed (without any formatting), |
- | <code> | + | <nowiki> |
- | Split(" | + | This is some text which contains addresses like this: http:// |
- | <-list CopyList ->list2 | + | </nowiki> |
- | SetListElement(< | + | The same is true for %%// |
- | Trace(< | + | |
- | Trace(< | + | |
- | </ | + | |
- | ---- | + | < |
+ | This is some text which contains addresses like this: http:// | ||
+ | </ | ||
+ | The same is true for %%// | ||
+ | ===== Code Blocks ===== | ||
- | ---- | + | You can include code blocks into your documents by either indenting them by at least two spaces (like used for the previous examples) or by using the tags '' |
- | ====== cos ====== | + | This is text is indented by two spaces. |
- | + | ||
- | cos(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Calculates the cosine of the input angle in radians | + | |
- | + | ||
- | ===== Examples ===== | + | |
< | < | ||
- | trace(cos(PI)) #prints '-1' | + | This is preformatted code all spaces are preserved: like <-this |
</ | </ | ||
- | ---- | + | < |
+ | This is pretty much the same, but you could use it to show that you quoted a file. | ||
+ | </ | ||
+ | Those blocks were created by this source: | ||
- | ---- | + | This is text is indented by two spaces. |
- | ====== CR ====== | + | < |
+ | This is preformatted code all spaces are preserved: like <-this | ||
+ | </ | ||
- | CR | + | < |
+ | This is pretty much the same, but you could use it to show that you quoted a file. | ||
+ | </ | ||
- | ===== Description ===== | + | ==== Syntax Highlighting |
- | Pushes a carriage return | + | [[wiki: |
- | ===== Examples ===== | + | < |
- | + | /** | |
- | < | + | * The HelloWorldApp class implements an application that |
- | Trace( Concat (Concat("ABC" | + | * simply displays |
+ | */ | ||
+ | class HelloWorldApp { | ||
+ | public static void main(String[] args) { | ||
+ | System.out.println("Hello World!"); //Display the string. | ||
+ | } | ||
+ | } | ||
</ | </ | ||
- | ---- | + | The following language strings are currently recognized: //4cs 6502acme 6502kickass 6502tasm 68000devpac abap actionscript3 actionscript ada aimms algol68 apache applescript apt_sources arm asm asp asymptote autoconf autohotkey autoit avisynth awk bascomavr bash basic4gl batch bf biblatex bibtex blitzbasic bnf boo caddcl cadlisp ceylon cfdg cfm chaiscript chapel cil c_loadrunner clojure c_mac cmake cobol coffeescript c cpp cpp-qt cpp-winapi csharp css cuesheet c_winapi dart dcl dcpu16 dcs delphi diff div dos dot d ecmascript eiffel email epc e erlang euphoria ezt f1 falcon fo fortran freebasic freeswitch fsharp gambas gdb genero genie gettext glsl gml gnuplot go groovy gwbasic haskell haxe hicest hq9plus html html4strict html5 icon idl ini inno intercal io ispfpanel java5 java javascript jcl j jquery julia kixtart klonec klonecpp kotlin latex lb ldif lisp llvm locobasic logtalk lolcode lotusformulas lotusscript lscript lsl2 lua m68k magiksf make mapbasic mathematica matlab mercury metapost mirc mk-61 mmix modula2 modula3 mpasm mxml mysql nagios netrexx newlisp nginx nimrod nsis oberon2 objc objeck ocaml-brief ocaml octave oobas oorexx oracle11 oracle8 oxygene oz parasail parigp pascal pcre perl6 perl per pf phix php-brief php pic16 pike pixelbender pli plsql postgresql postscript povray powerbuilder powershell proftpd progress prolog properties providex purebasic pycon pys60 python qbasic qml q racket rails rbs rebol reg rexx robots roff rpmspec rsplus ruby rust sas sass scala scheme scilab scl sdlbasic smalltalk smarty spark sparql sql sshconfig standardml stonescript swift systemverilog tclegg tcl teraterm texgraph text thinbasic tsql twig typoscript unicon upc urbi uscript vala vbnet vb vbscript vedit verilog vhdl vim visualfoxpro visualprolog whitespace whois winbatch wolfram xbasic xml xojo xorg_conf xpp yaml z80 zxbasic// |
+ | There are additional [[doku> | ||
- | ---- | + | ==== Downloadable Code Blocks ==== |
- | ====== CreateList ====== | + | When you use the '' |
- | + | ||
- | CreateList | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Creates an empty list. | + | |
- | + | ||
- | ===== Examples ===== | + | |
< | < | ||
- | if (CreateList GetListCount eq0) | + | <file php myexample.php> |
- | | + | <?php echo "hello world!"; ?> |
- | endif | + | </file> |
- | + | ||
- | createlist ->list | + | |
- | 1 ->list[0] | + | |
- | 4 -> | + | |
- | 9 -> | + | |
- | trace(< | + | |
</ | </ | ||
- | ---- | + | <file php myexample.php> |
+ | <?php echo "hello world!"; | ||
+ | </ | ||
+ | If you don't want any highlighting but want a downloadable file, specify a dash ('' | ||
- | ---- | ||
- | ====== CreateListStartingSize ====== | + | ===== Embedding HTML and PHP ===== |
- | createliststartingsize (%%<-%%size) %%->%%list | + | You can embed raw HTML or PHP code into your documents by using the '' |
- | ===== Description ===== | + | HTML example: |
- | + | ||
- | Creates a list containing a specified number of null elements. | + | |
- | + | ||
- | ===== Examples ===== | + | |
< | < | ||
- | + | < | |
- | 9 ->nullSize | + | This is some <span style=" |
- | createliststartingsize (<-nullSize) ->nullist | + | </html> |
- | trace ( <-nullist) | + | <HTML> |
+ | <p style=" | ||
+ | </ | ||
</ | </ | ||
- | ---- | + | < |
- | + | This is some <span style=" | |
- | ====== CreateTable ====== | + | </ |
- | + | <HTML> | |
- | createTable %%->%%table | + | <p style=" |
- | + | </ | |
- | ===== Description ===== | + | |
- | + | ||
- | Creates an empty table and pushes it to the stack. | + | |
- | ===== Examples ===== | + | PHP example: |
< | < | ||
- | createTable ->table | + | <php> |
- | 1 -> | + | echo 'The PHP version: '; |
- | 4 ->table{" | + | echo phpversion(); |
- | 9 ->table{"Curly"} | + | echo ' (generated inline HTML)'; |
- | trace(<-table) | + | </php> |
+ | <PHP> | ||
+ | echo '<table class="inline">< | ||
+ | echo '< | ||
+ | echo '</ | ||
+ | </ | ||
</ | </ | ||
- | ---- | + | < |
+ | echo 'The PHP version: '; | ||
+ | echo phpversion(); | ||
+ | echo ' (inline HTML)'; | ||
+ | </ | ||
+ | < | ||
+ | echo '< | ||
+ | echo '< | ||
+ | echo '</ | ||
+ | </ | ||
+ | **Please Note**: HTML and PHP embedding is disabled by default in the configuration. If disabled, the code is displayed instead of executed. | ||
- | ---- | + | ===== RSS/ATOM Feed Aggregation ===== |
+ | [[DokuWiki]] can integrate data from external XML feeds. For parsing the XML feeds, [[http:// | ||
- | ====== Debug ====== | + | ^ Parameter |
+ | | any number | will be used as maximum number items to show, defaults to 8 | | ||
+ | | reverse | ||
+ | | author | ||
+ | | date | show item dates | | ||
+ | | description| show the item description. If [[doku> | ||
+ | | nosort | ||
+ | | //n//[dhm] | refresh period, where d=days, h=hours, m=minutes. (e.g. 12h = 12 hours). | | ||
- | debug | + | The refresh period defaults to 4 hours. Any value below 10 minutes will be treated as 10 minutes. [[wiki: |
- | ===== Description ===== | + | By default the feed will be sorted by date, newest items first. You can sort it by oldest first using the '' |
- | Debug peeks at the stack and then prints out the datatype of the top item on the stack followed by the value coerced into an int, float, and string. | + | **Example: |
- | ===== Examples ===== | + | {{rss> |
- | <code> | + | {{rss>http:// |
- | 12 | + | |
- | debug | + | |
- | trace (mul (4)) # | + | |
- | # output_log.txt will contain | + | |
- | # INT 12 12 12 | + | |
- | # | + | |
- | </code> | + | |
- | ---- | ||
+ | ===== Control Macros ===== | ||
- | ---- | + | Some syntax influences how DokuWiki renders a page without creating any output it self. The following control macros are availble: |
- | ====== DeepCopyList ====== | + | ^ Macro ^ Description | |
+ | | %%~~NOTOC~~%% | ||
+ | | %%~~NOCACHE~~%% | DokuWiki caches all output by default. Sometimes this might not be wanted (eg. when the %%< | ||
- | DeepCopyList ( %%< | + | ===== Wrap Syntax Demo page ===== |
+ | https:// | ||
+ | ===== Syntax Plugins ===== | ||
- | ===== Description ===== | + | DokuWiki' |
- | Creates a copy of a list with the same contents. Unlike [[CopyList | CopyList]], if the copied list contains other lists, those lists will be copied as well (and if those lists contain other lists, even those will be copied, etc, etc). See [[Copy vs Deep Copy | Copy vs Deep Copy]] for more info. | + | ~~INFO:syntaxplugins~~ |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Split(" | + | |
- | Split(" | + | |
- | <-list < | + | |
- | + | ||
- | <-list CopyList -> | + | |
- | <-list DeepCopyList -> | + | |
- | SetListElement(< | + | |
- | SetListElement(< | + | |
- | + | ||
- | Trace(< | + | |
- | Trace(< | + | |
- | Trace(< | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Deg2Rad ====== | + | |
- | + | ||
- | mul(Deg2Rad %%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes the constant to use in converting from degrees to radians to the stack. Multiply this value with a value expressed as degrees to obtain radians. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(180 mul(Deg2Rad)) #prints PI | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== DISTANCE ====== | + | |
- | + | ||
- | distance(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Returns the distance between two given pairs of coordinates. (Or two sets of number pairs on the coordinate plane) | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | CurrentCoords 0 0 Distance -> | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== div ====== | + | |
- | + | ||
- | %%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Divides the two arguments together and pushes the result on the stack. the output type (integer or float) depends on the input, except is the result is explicitly cast. See examples. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(5 div(4)) #prints ' | + | |
- | trace(5 div(4.0)) #prints ' | + | |
- | trace(5 div(4 asfloat)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== do ====== | + | |
- | + | ||
- | do(5 0) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | The statements following the do, up to the loop statement, are executed repeatedly. Each iteration (loop), the initial value (Index) is incremented by one at the bottom of the loop and compared to Limit. When Index=Limit, | + | |
- | + | ||
- | NOTE: Limit comes first, then the initial value (index). This means that the first number should usually be bigger than the second number. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | # single loop | + | |
- | do(5 0) | + | |
- | | + | |
- | loop | + | |
- | # Prints: | + | |
- | # 0 | + | |
- | # 1 | + | |
- | # 2 | + | |
- | # 3 | + | |
- | # 4 | + | |
- | + | ||
- | Nested loops | + | |
- | + | ||
- | do(2 0) | + | |
- | trace(I) | + | |
- | Do (4 2) | + | |
- | Trace2 (J I) | + | |
- | Do (6 4) | + | |
- | Trace3 (K J I ) | + | |
- | loop | + | |
- | loop | + | |
- | loop | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== DQ ====== | + | |
- | + | ||
- | DQ | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes a double-quote (") to the stack. This is the only way to create a string containing this character as they are normally used to delineate strings. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | DQ " | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== dup ====== | + | |
- | + | ||
- | dup | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Duplicates the item currently on the stack without removing the original item. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace2(42 dup) #prints '42 42' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== dup2 ====== | + | |
- | + | ||
- | dup2 | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Duplicates the top two items currently on the stack without removing the original pair. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace4(42 1 dup2) #prints '42 1 42 1' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== E ====== | + | |
- | + | ||
- | e | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes the value of Euler’s number (e) to the stack (2.71828…) | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(e) #prints 2.71828182845 | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== else ====== | + | |
- | + | ||
- | else | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | When an if statement evaluates to false, then the statements following the else, up to the endif, are executed instead. See [[if | if]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (<-var eq (1)) | + | |
- | #Do something | + | |
- | else | + | |
- | #Do something else | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== endif ====== | + | |
- | + | ||
- | endif | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Deimits the scope of an if-else-statement. Instructions between the if and endif statement are conditionally executed, depending on the results of the if evaluation. See [[if | if]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (<-var eq (1)) | + | |
- | #Do something | + | |
- | else | + | |
- | #Do something else | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== endonce ====== | + | |
- | + | ||
- | endonce | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Ends a block defined by once. See [[once | once]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | once | + | |
- | trace(" | + | |
- | endonce | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== EndsWith ====== | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Takes two strings from the stack and returns whether the first string ends with the second (case sensitive) | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (EndsWith(" | + | |
- | Trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== endwhile ====== | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Returns execution to the ‘while’ statement. Note that endwhile is only executed, if ‘repeat’ evaluated to true. See [[while | While]] and [[repeat | repeat ]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | 5 ->y | + | |
- | while | + | |
- | <-y gt(0) #is y greater than zero? | + | |
- | repeat | + | |
- | trace(< | + | |
- | <-y sub(1) -> | + | |
- | endwhile | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== eq ====== | + | |
- | + | ||
- | eq | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Top two items are popped from the stack and compared for equality. 0 or 1 is pushed back to the stack where 1 indicates equal and 0 (zero) ndicates not equal | + | |
- | + | ||
- | the equal/not equal evaluation can also be performed with “true” (1) and false(0), respectively. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (1 eq (1)) | + | |
- | trace(" | + | |
- | endif | + | |
- | + | ||
- | # alternate example | + | |
- | + | ||
- | 1 dup eq | + | |
- | if true | + | |
- | trace ("one is always one" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== eq0 ====== | + | |
- | + | ||
- | eq0 | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Top item is popped from the stack and Compared to 0. 0 (false) or 1 (true) is pushed back to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (0 eq0) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== false ====== | + | |
- | + | ||
- | false | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes a 0 (false) nto the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (false) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== floor ====== | + | |
- | + | ||
- | floor (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Takes one number from the stack, rounds it down, and pushes that number back on the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(floor(4.2)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== GetListCount ====== | + | |
- | + | ||
- | GetListCount(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Returns the number of entries in a list. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Split(" | + | |
- | Trace(GetListCount(< | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== GetListElement ====== | + | |
- | + | ||
- | GetListElement (I) %%-> | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Returns the value at the specified index of a list. Lists are indexed from zero. | + | |
- | + | ||
- | Note: If a list is stored in a variable, this can be abbreviated to %%< | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Split(" | + | |
- | 6 0 do | + | |
- | Trace (<-list I GetListElement) | + | |
- | Trace (< | + | |
- | loop | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Gettableelement ====== | + | |
- | + | ||
- | To be supplied | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== GetType ====== | + | |
- | + | ||
- | GetType (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Takes a value and returns a string of what type of value it is. Types: STRING INT FLOAT LIST NULL | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | " | + | |
- | <-Type trace #Would return STRING as the result | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== gt ====== | + | |
- | + | ||
- | 5 gt (4) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | The first item on the stack is compared to the second item on the stack. Both items are removed from the stack. If the first item is greater than the second, True (1) is pushed to the stack. If not, False (o) is pushed to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | # Warp notation | + | |
- | if (42 gt (1)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== gte ====== | + | |
- | + | ||
- | 5 gte (5) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | The first item on the stack is compared to the second item on the stack. Both items are removed from the stack. If the first item is greater than or equal to the second, True (1) is pushed to the stack. If not, False (o) is pushed to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (2 gte (2)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== HALFPI ====== | + | |
- | + | ||
- | HALFPI | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes the value of PI/2 to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(HALFPI) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== I ====== | + | |
- | + | ||
- | I | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Current loop index. Pushes the value of the current “do” loop onto the stack. Only use within loops. | + | |
- | + | ||
- | Note that I refers to the innermost loop. As loops are nested, I will continue to reference the innermost of the nested loops. See [[J | J]] [[k | K]] for other loop indexes. See [[do | Do]] and [[loop | Loop]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | do(2 0) | + | |
- | trace(I) | + | |
- | Do (4 2) | + | |
- | Trace2 (J I) | + | |
- | Do (6 4) | + | |
- | Trace3 (K J I ) | + | |
- | loop | + | |
- | loop | + | |
- | loop | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== if ====== | + | |
- | + | ||
- | if (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Evaluate the first element on the stack. If True, then execute statements that follow, up to the endif or else statement. If False, execution skips to the first statement following the endif or else statement. Any nonzero value is considered True, a value of zero is False. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (<-var eq (1)) | + | |
- | #Do Something | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== InsertListElement ====== | + | |
- | + | ||
- | InsertListElement(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Stores a value at the specified index of a list. The previously stored value, and all subsequent values have their indices shifted up by one. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Split(" | + | |
- | InsertListElement(< | + | |
- | Trace(< | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== J ====== | + | |
- | + | ||
- | J | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | First outer loop index. When loops are nested, this pushes the value of the first (or only) outer “do” loop onto the stack. Do not use outside nested loops. | + | |
- | + | ||
- | Note: after the inner loop finishes, this value is accessed with I, it being now the innermost loop. See also: [[do | do]], [[I | I]], [[K | K]], and [[loop | Loop]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | do(6 5) | + | |
- | do(4 3) | + | |
- | trace4 (" | + | |
- | loop | + | |
- | | + | |
- | loop | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== K ====== | + | |
- | + | ||
- | K | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Outer loop index. When “do” loops are nested, this pushes the value of the third-innermost loop onto the stack. Do not use outside of triply-nested loops. | + | |
- | + | ||
- | Note that before the inner loops begin, after they end, or between inner loops, this value may need to be referred to with J or even I. See also: [[do | Do]], [[I | I]], [[J | J]], and [[loop | Loop]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | do(2 1) | + | |
- | do(4 3) | + | |
- | do(6 5) | + | |
- | I J K Trace3 | + | |
- | loop | + | |
- | loop | + | |
- | loop | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== LF ====== | + | |
- | + | ||
- | LF | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes a line feed to the stack. Useful for printing | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Trace( Concat (Concat(" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== ln ====== | + | |
- | + | ||
- | LN | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | The natural logarithm. Gives the magnitude of the number. On zero, returns -inf. Below zero, returns NaN, a special value that always causes failure when compared to other numbers. Eg. (NaN<0) %%->%% false, (Nan>=0) %%->%% false | + | |
- | + | ||
- | other logarithms \ ln(x) = log(x, e) \\\ | + | |
- | ln(x)/ | + | |
- | ln(2)=0.6931… \\\ | + | |
- | ln(e)=.999999 \\\ | + | |
- | ln(10)=2.3026… \ | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(ln(-1)) #prints ' | + | |
- | trace(ln(0)) | + | |
- | trace(ln(1)) | + | |
- | trace(ln(e)) | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== log ====== | + | |
- | + | ||
- | log | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Allows the performance of arbitrary based logarithms. See examples. On zero, returns -inf. Below zero, returns NaN, a special value that always causes failure when compared to other numbers. Eg. (NaN<0) %%->%% false, (Nan>=0) %%->%% false | + | |
- | + | ||
- | other logarithms \\\ | + | |
- | log(x,10) = log10(x) \\\ | + | |
- | log(x,e) = ln(x) | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(log(2 .5)) # | + | |
- | trace(log(.25 .5)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== log10 ====== | + | |
- | + | ||
- | LOG10 | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | The base ten logarithm. Gives the number of digits in the number before the decimal point. On zero, returns -inf. Below zero, returns NaN, a special value that always causes failure when compared to other numbers. Eg. (NaN<0) %%->%% false, (Nan>=0) %%->%% false | + | |
- | + | ||
- | other logarithms %%//%% log10(x) = log(x, 10) %%//%% log10(x)/ | + | |
- | log10(10)=1 \\\ | + | |
- | + | ||
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(log10(1)) | + | |
- | trace(log10(10)) # prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== loop ====== | + | |
- | + | ||
- | LOOP | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Terminates the ‘do’ instruction loop . Control flow will return to the ‘do’ instruction until the Index is equal to the Limit. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | do(5 0) | + | |
- | | + | |
- | loop | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== lt ====== | + | |
- | + | ||
- | LT | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | First item on the stack is compared to the second item on the stack.\\ | + | |
- | 0 (fasle) or 1 (true) is pushed to the stack depending on whether the first value was less than the second or not. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (1 lt (42)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== lte ====== | + | |
- | + | ||
- | LTE | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | First item on the stack is compared to the second item on the stack.\\ | + | |
- | 0 (fasle) or 1 (true) is pushed to the stack depending on whether the first value was less or equal to the second or not. ## Examples | + | |
- | + | ||
- | < | + | |
- | if (1 lte (1)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== max ====== | + | |
- | + | ||
- | MAX | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Push the greater of two arguments to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(max(4 5)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== min ====== | + | |
- | + | ||
- | MIN | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Push the smaller of two arguments to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(max(4 5)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== mod ====== | + | |
- | + | ||
- | MOD | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Perform integer division and returns the value (modulo) of the difference. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(5 mod (3)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== mul ====== | + | |
- | + | ||
- | MUL | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Multiplies the two arguments together and pushes the result on the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(2 mul(3)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== neg ====== | + | |
- | + | ||
- | NEG | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Calculates the negative value of the item and pushes the result on the stack. The result is effectively the same as multiplying the original number by -1. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(neg(42)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== neq ====== | + | |
- | + | ||
- | NEQ | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Top two items are popped from the stack and compared for equality. 0 or 1 is pushed back to the stack where 0 indicates false and 1 indicates true. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (1 neq (2)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== neq0 ====== | + | |
- | + | ||
- | NEQ0 | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | first item on the stack is compared to zero. If zero, true (1) is pushed on the stack, otherwise falsse (0) is pushed back to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (1 neq0) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== not ====== | + | |
- | + | ||
- | NOT | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Treats first item on the stack as a boolean value (true/false (1/0) , ‘nots’ it, and pushes 0 or 1 back to the stack. If the item is TRUE, 0 is pushed to the stack. If the item is FALSE, 1 is pushed to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (not(false)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== NotPersist ====== | + | |
- | + | ||
- | NotPersist(“var_name”) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | By default, variables persist across saves. Using this command makes them not persist across saves. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | NotPersist(" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== once ====== | + | |
- | + | ||
- | ONCE | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Start a block of instructions that are executed once only for the lifetime of the entity the script is associated with. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | once | + | |
- | trace(" | + | |
- | endonce | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== or ====== | + | |
- | + | ||
- | OR | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pops two items from the stack, treats them as boolean values, ‘ors’ them, and pushes 0 or 1 back to the stack. If one or both items evaluate to True, it returns TRUE (1) to the stack. If both items evaluate to FALSE, FALSE (0) is returned to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (1 or (false)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== PI ====== | + | |
- | + | ||
- | PI | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes the value of PI (3.14159265…) to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(PI) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== pop ====== | + | |
- | + | ||
- | POP | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Removes the item at the top of the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | 42 pop #stack is now empty | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== pow ====== | + | |
- | + | ||
- | POW | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pops two arguments from the stack and raises the first to the second and pushes the result to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Trace (8 pow (3)) ) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== PrependStackToList ====== | + | |
- | + | ||
- | PrependStackToList (“Hello” “Creeper” “World” %%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Inserts the contents of the stack at the beginning of L1 (at index 0) and shifts the index of all other elements in the list up by the number of elements on the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | createlist ->list | + | |
- | AppendStacktoList (" | + | |
- | PrependStackToList (" | + | |
- | print (< | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== PrependToList ====== | + | |
- | + | ||
- | PrependToList ( <-list item) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Adds a value to the beginning of a list. Any values previously stored in the list are shifted up by one. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Split(" | + | |
- | PrependToList( <-list 0) | + | |
- | Trace(< | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Print ====== | + | |
- | + | ||
- | PRINT (“Hello World”) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Takes one item from the stack and writes it on a new line in a file called PRPL.txt in the game’s root content folder, preceded by the identifying information that indicates which unit or component called the PRINT function. Note that this file is truncated (cleared) each time a map is loaded. | + | |
- | + | ||
- | To avoid having to constantly re-open the RPL.txt file to refresh it, a Windows Powershell commad (or Linus shell command) can be written to monitor the file and show new output. | + | |
- | + | ||
- | Eg. Create a file in the game’s root directory named ShowRPL.PS1. Put this single line in the file | + | |
- | + | ||
- | < | + | |
- | Get-Content RPL.txt -wait | + | |
- | </ | + | |
- | Now, in the context menu for the file, click on “Run with PowerShell”. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | # Assume this core is at map coordinates (100, 50). Assume this script is named " | + | |
- | "Hello World!" | + | |
- | # Each time this line is invoked, a new line appears in PRPL.txt: | + | |
- | # [100,50] Hello.prpl: Hello World! | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Print2 ====== | + | |
- | + | ||
- | PRINT2 (“Hello” “World”) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints 2 values from the stack into the rpl.txt output file. See [[PRINT | PRINT]] or more details | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Print2 (" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Print3 ====== | + | |
- | + | ||
- | PRINT3 (“Hello” “World” " Again" | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints 3 values from the stack into the rpl.txt output file. See [[PRINT | PRINT]] for more details | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Print3 (" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Print4 ====== | + | |
- | + | ||
- | PRINT4 (“Oh” “Hello” “World” " Again" | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints 4 values from the stack into the rpl.txt output file. See [[PRINT | PRINT]] for more details | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Print4 | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Print5 ====== | + | |
- | + | ||
- | PRINT4 (“not” “another” “Hello” “world” “example”) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints 5 values from the stack into the rpl.txt output file. See [[PRINT | PRINT]] for more details | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Print5 (<-x " | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== PrintAll ====== | + | |
- | + | ||
- | PrintAll | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Removes all values from the stack and prints them in the RPL.txt file The values will be on a single line and **not** separated by a space when printed. See [[PRINT | PRINT]] for more details | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | PRINTALL (" | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== PrintAllSp ====== | + | |
- | + | ||
- | PrintAllSp | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Removes all values from the stack and prints them into the RPL.txt file The values will be on a single line and **will** be separated by a space when printed. See [[PRINT | PRINT]]] for more details | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | PRINTALLSP (" | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== PrintStack ====== | + | |
- | + | ||
- | PrintStack | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints all the values from the stack to the RPL.txt file without removing them. The top and bottom of the stack will be identidfied, | + | |
- | + | ||
- | Note ## Examples | + | |
- | + | ||
- | < | + | |
- | PrintStack (" | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== QUARTERPI ====== | + | |
- | + | ||
- | QuarterPI | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes the value of PI/4 to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(HALFPI) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Rad2Deg ====== | + | |
- | + | ||
- | Rad2Deg | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes the constant to use in converting radians to degrees onto the stack. Multiply this value with a value expressed in radians to obtain degrees. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(PI mul(Rad2Deg)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== RANDFLOAT ====== | + | |
- | + | ||
- | randfloat (%%H%%rando ) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Gives a random floating-point number between 0 and 1 | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Trace ( RandFloat mul ( 2 mul (PI))) | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== RANDINT ====== | + | |
- | + | ||
- | randInt((0 10)) %%-> | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Returns a random integer from a range of two numbers Inclusive of the lower number, but exclusive of the higher number. A workaround for between 0 and 10 both inclusive is in the example below. is to do 0 11 RandInt, so 11 will exclude but 10 will include [basically, 0 10 1 add RandInt] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | # get a random integer between 1 and 10 (both numbers inclusive) | + | |
- | RandInt(0 11) | + | |
- | # | + | |
- | # or | + | |
- | # | + | |
- | RandInt( 0 10 add (1)) # functionally equivalent. | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== RemoveListElement ====== | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Removes an element from a list at a given position. Position are indexed from 0. | + | |
- | + | ||
- | Elements after the removed one will be shifted towards the start of the list. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | createlist ->list | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | RemoveListElement(< | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== removetableelement ====== | + | |
- | + | ||
- | To be supplied | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== repeat ====== | + | |
- | + | ||
- | Repeat | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Part of the " | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | 5 ->y | + | |
- | while | + | |
- | <-y gt(0) #is y greater than zero? | + | |
- | repeat | + | |
- | trace(< | + | |
- | <-y sub(1) -> | + | |
- | endwhile | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== return ====== | + | |
- | + | ||
- | Return | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Stops execution of a function call and returns immediately. If called from some place other than a function, it will stop the script execution and ‘return’ immediately. Useful for aborting function execution or script execution when necessary. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(42) | + | |
- | @MyFunc | + | |
- | trace (43) | + | |
- | + | ||
- | :MyFunc | + | |
- | trace(" | + | |
- | return | + | |
- | trace(" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== round ====== | + | |
- | + | ||
- | Round (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Rounds off a number to the specified number of decimal places. This always returns a float, even when you are rounding to a whole number. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(PI round(2)) #print ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== SetListElement ====== | + | |
- | + | ||
- | SetListElement(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Stores a value at the specified index of a list. The previously stored value is overwritten. | + | |
- | + | ||
- | If a list is stored in a variable, this can be abbreviated to %%< | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Split(" | + | |
- | SetListElement(< | + | |
- | " | + | |
- | Trace(< | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== settableelement ====== | + | |
- | + | ||
- | To be supplied | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== ShortestAngle ====== | + | |
- | + | ||
- | ShortestAngle(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Given two angles, calculates the shortest angle between the two. Useful for determining which direction a unit should rotate in order to turn to a given direction. A positive or negative value will be returned in the range of PI to -PI. Negative values indicate clockwise rotation. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(ShortestAngle(1.1 2.5)) | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== SignalGenerator ====== | + | |
- | + | ||
- | SignalGenerator(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Computes the value for a given signal waveform and pushes it to the stack. | + | |
- | + | ||
- | A function to derive the y-coordinate for a given x-co-ordiante on a graph line following one of the indicated wave patterns. Uselful to animate an object or to a given pattern over time. Could be used for instance to vary output from an emitter. Oscillating rightness of light source or beacon; Oscillating strength of an emitter over time - both of these can be thought of as a a use case for this function. | + | |
- | + | ||
- | Arguments and type in order: 1: Integer. the X coordinate in the waveform (Eg. time) \\\ | + | |
- | 2: Float. Frequency of the waveform \\\ | + | |
- | 3: Float. PhaseShift of the waveform \\\ | + | |
- | 4: Bool. invert the waveform \ 5: Integer. Signal type (0 to 6 in types, below) \ | + | |
- | + | ||
- | Signal types. 0 = NONE < | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | # On a map with terrain of 200 in X direction and at least 150 in Z direction (3D coordinates) | + | |
- | # generate a sine wave of creeper across the map. | + | |
- | 200 -> | + | |
- | -> | + | |
- | 0 | + | |
- | false -> | + | |
- | 1 | + | |
- | + | ||
- | do (< | + | |
- | SignalGenerator(I < | + | |
- | round (< | + | |
- | print3 (I " : " < | + | |
- | SetCreeper(I 75 add (< | + | |
- | loop | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== sin ====== | + | |
- | + | ||
- | sin (PI) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Calculates the sine of the input angle | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(sin(PI)) #prints 0 | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Split ====== | + | |
- | + | ||
- | Split (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Takes two strings from the stack and splits the first wherever the second occurs. Returns a list of strings. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Split(" | + | |
- | < | + | |
- | Trace(< | + | |
- | loop | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== sqrt ====== | + | |
- | + | ||
- | SQRT (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pops an item from the stack and pushes the square root of that number to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(sqrt(9)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== StackSize ====== | + | |
- | + | ||
- | StackSize < | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Returns the number of items currently on the stack | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | 1 2 3 trace(StackSize) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== StartsWith ====== | + | |
- | + | ||
- | StartsWith (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Takes two strings from the stack and returns whether the first string starts with the second (case sensitive) | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (StartsWith(" | + | |
- | Trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== StringLength ====== | + | |
- | + | ||
- | Stringlength (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Returns the number of characters in a string. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Trace( StringLength (" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== StringReplace ====== | + | |
- | + | ||
- | StringReplace (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | string ARG1: The string to be searched string ARG2: The string to search for in ARG1 string ARG3: The string to replace ARG2 with | + | |
- | + | ||
- | Searches a string for all instances for another string, and replaces them with a different string. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Trace(StringReplace (" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== StringToList ====== | + | |
- | + | ||
- | StringToList (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Takes a string from the stack and returns the list of characters in the string. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | StringToList(" | + | |
- | < | + | |
- | Trace(< | + | |
- | loop | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== sub ====== | + | |
- | + | ||
- | 44 sub (2) %%-> | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Subtracts the two arguments together and pushes the result on the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(44 sub(2)) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Substring ====== | + | |
- | + | ||
- | Substring (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Extracts a portion of a string into a new item on the stack. | + | |
- | + | ||
- | The command has 3 arguments. First the string to be examined, second the starting position of the substring within the original string, starting from offset 0 (zero) and thirdly the length of the extrated string. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Trace( Substring(" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== swap ====== | + | |
- | + | ||
- | swap | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Swaps the order of the top two items on the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace2(swap(1 2)) #prints '2 1' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== tan ====== | + | |
- | + | ||
- | tan (PI) %%-> | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Calculates the tangent of the input angle. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(tan(PI)) #prints 0 | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== TAU ====== | + | |
- | + | ||
- | TAU | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes the value of TAU (2PI) to the stack (6.2831853…) | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(TAU) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== ToLower ====== | + | |
- | + | ||
- | ToLower(%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Converts a string to lowercase. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Trace( ToLower(" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== ToUpper ====== | + | |
- | + | ||
- | ToUpper (%%< | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | Trace( ToUpper(" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Trace ====== | + | |
- | + | ||
- | Trace (“ABC”) | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints a value from the stack into the debug window. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Trace (" | + | |
- | + | ||
- | if (<-value lt (0)) | + | |
- | Trace (" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Trace2 ====== | + | |
- | + | ||
- | Trace2 (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints 2 values from the stack into the debug window. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Trace2 (" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Trace3 ====== | + | |
- | + | ||
- | Trace3 (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints 3 values from the stack into the debug window. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Trace3 (" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Trace4 ====== | + | |
- | + | ||
- | Trace4 (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints 4 values from the stack into the debug window. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Trace3 ("3 Coords:" | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== Trace5 ====== | + | |
- | + | ||
- | Trace5 (%%< | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints 5 values from the stack to the debug window. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Trace5 (<-x " plus " <-y " is " < | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== TraceAll ====== | + | |
- | + | ||
- | TraceAll | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Removes all the values from the stack and prints them into the debug console. The values will be on a single line and **not** separated by a space when printed. Compare to [[TraceAllSp | TraceAllSP]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | + | ||
- | traceAll | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== TraceAllSp ====== | + | |
- | + | ||
- | TraceAllSp | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Removes all the values from the stack and prints them into the debug console. The values will be on a single line and **will** be separated by a space when printed. Comparae to [[traceAll | TraceAll]] | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | + | ||
- | traceAllSp | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== TraceStack ====== | + | |
- | + | ||
- | TraceStack | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Prints all the items from the stack to the debug window without removing them. Items are printed one per line and the type of each is also provided. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | + | ||
- | # inspect what a function does to the stack | + | |
- | TraceStack # see stack before the call | + | |
- | @MyFunction | + | |
- | TraceStack # see stack after the call | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== true ====== | + | |
- | + | ||
- | true | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes a 1 onto the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (true) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== TWOPI ====== | + | |
- | + | ||
- | TwoPI | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pushes the value of TAU (2PI) to the stack (6.2831853…) | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | trace(TWOPI) #prints ' | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== while ====== | + | |
- | + | ||
- | While | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Beginning of a while loop. The statements between a ‘while’ and a ‘repeat’ should ultimately push a value to the stack that will determine if the loop executes the body of the ‘repeat’ block. | + | |
- | + | ||
- | A while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be thought of as a repeating if statement. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | 5 ->y | + | |
- | while < | + | |
- | repeat | + | |
- | trace(< | + | |
- | <-y sub(1) -> | + | |
- | endwhile | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | + | ||
- | ---- | + | |
- | + | ||
- | ====== xor ====== | + | |
- | + | ||
- | XOR | + | |
- | + | ||
- | ===== Description ===== | + | |
- | + | ||
- | Pops two items from the stack, treats them as boolean values, ‘xors’ them, and pushes 0 or 1 back to the stack. If both items are TRUE, 0 is pushed to the stack. If both items are FALSE, 0 is pushed to the stack. If one item is TRUE and the other is FALSE, 1 is pushed to the stack. | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | < | + | |
- | if (1 xor (false)) | + | |
- | trace(" | + | |
- | endif | + | |
- | </ | + | |
- | + | ||
- | ---- | + | |