mpl
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
mpl [2016/07/11 16:25] – [IF THEN/ELSE/END] gryphon | mpl [2016/07/13 21:27] (current) – g00r00 | ||
---|---|---|---|
Line 23: | Line 23: | ||
==== Comments ==== | ==== Comments ==== | ||
- | All text after a two slashes (⁄⁄) is considered a comment. | + | All text after a two slashes (⁄⁄) is considered a comment. |
WriteLn (' | WriteLn (' | ||
| | ||
Line 52: | Line 53: | ||
Const | Const | ||
- | | + | |
- | // note: this value has changed check records.pas! | + | |
Begin | Begin | ||
- | GetThisUser | + | GetThisUser; |
| | ||
If UserFlags AND UserDeleted <> 0 Then | If UserFlags AND UserDeleted <> 0 Then | ||
- | WriteLn(' | + | WriteLn(' |
- | End; | + | End; |
==== Defining Variables ==== | ==== Defining Variables ==== | ||
All variables are global to all of the program, including procedures. | All variables are global to all of the program, including procedures. | ||
- | Var <VarName> : <VarType> | + | Var <Variable Name> : <Variable Type> |
| | ||
Examples: | Examples: | ||
| | ||
- | | + | |
- | | + | |
| | ||
- | | + | |
- | | + | |
- | | + | |
| | ||
The following variable types are supported: | The following variable types are supported: | ||
Line 86: | Line 87: | ||
Word Numerical | Word Numerical | ||
LongInt | LongInt | ||
+ | Cardinal | ||
Real Numerical | Real Numerical | ||
- | All variables except ARRAYs can be initialized when when defined. | + | All variables except ARRAYs can be initialized when when defined: |
Var TotalBases : LongInt = GetMBaseTotal(False) | Var TotalBases : LongInt = GetMBaseTotal(False) | ||
Line 96: | Line 98: | ||
ARRAY multi-dimensional variables are supported. | ARRAY multi-dimensional variables are supported. | ||
- | Var < | + | Var < |
- | Var < | + | Var < |
- | Var < | + | Var < |
Examples: | Examples: | ||
- | Var Dummy : Array[1..10] of Byte | + | Var Dummy : Array[1..10] of Byte; |
- | Var Str : Array[5..10] of String | + | Var Str : Array[5..10] of String; |
- | Var Int : Array[1..10, | + | Var Int : Array[1..10, |
- | HEXIDECIMAL values are supported. | + | HEXIDECIMAL values are supported. |
- | Some examples: | + | |
Const | Const | ||
MyHexValue = $1F; | MyHexValue = $1F; | ||
| | ||
- | | + | |
| | ||
- | If Value = $10 Then WriteLn(' | + | If Value = $10 Then |
+ | | ||
==== Record Structures ==== | ==== Record Structures ==== | ||
Line 264: | Line 266: | ||
WriteLn ('A is not 1, 2, or 5...') | WriteLn ('A is not 1, 2, or 5...') | ||
==== CASE Statements ==== | ==== CASE Statements ==== | ||
+ | |||
+ | This has actually been expanded on from the Pascal standard but still follows the same syntax. | ||
+ | |||
+ | Var I : Integer = 10 | ||
+ | | ||
+ | Case I Of | ||
+ | 1 : WriteLn(' | ||
+ | 2 : Begin | ||
+ | | ||
+ | | ||
+ | End | ||
+ | 3, | ||
+ | WriteLn(' | ||
+ | End | ||
+ | |||
+ | Var S : String = ' | ||
+ | Case S[3] Of | ||
+ | ' | ||
+ | ' | ||
+ | Else | ||
+ | | ||
+ | End | ||
+ | |||
+ | ==== FUNCTIONS ==== | ||
+ | The syntax for defining a function is as follows: | ||
+ | |||
+ | Function < | ||
+ | |||
+ | IE: | ||
+ | |||
+ | Function AddTen (Num Byte) : Byte | ||
+ | Begin | ||
+ | AddTen := Num + 10 | ||
+ | End | ||
+ | ==== CONST VARIABLES ==== | ||
+ | The syntax for a constant variable is as follows: | ||
+ | |||
+ | String constants: | ||
+ | |||
+ | Const | ||
+ | SomeStr = 'Hello World!' | ||
+ | |||
+ | Numerical constants: | ||
+ | |||
+ | Const | ||
+ | SomeNum = 69 | ||
+ | |||
+ | Constant variables, like regular variables, can be separated with a comma: | ||
+ | |||
+ | Const | ||
+ | SomeNum = 69, | ||
+ | SomeStr = 'Hello World!' | ||
+ | |||
+ | At the moment, constant variables cannot be used in certain places within the MPE engine. | ||
mpl.1468272333.txt.gz · Last modified: 2016/07/11 16:25 by gryphon