|
| 1 | +# EZText |
| 2 | + |
| 3 | +EZText is a part of [EZCode](ezcode-docs) that translates Formatted English to EZCode. The English has to be in a specific format for it to work, but it allows EZCode to be written in paragraphs. It is initiated in EZCode with the [Special Keyword](ezcode-docs#special-keywords) `# eztext start` and `# eztext end`. Here is an example, |
| 4 | + |
| 5 | +``` |
| 6 | +# eztext start |
| 7 | +Create a variable named X with the value of 10. If the console input is equal to AddFifty, then add 50 to X. If not, then subtract 50 from X. |
| 8 | +# eztext end |
| 9 | +``` |
| 10 | +This EZText translates to the following EZCode, |
| 11 | +``` |
| 12 | +var X 10 |
| 13 | +var EZTEXT_GENERATED_VARIABLE : input console |
| 14 | +if 'EZTEXT_GENERATED_VARIABLE' = AddFifty : X + 50 |
| 15 | +else : X - 50 |
| 16 | +``` |
| 17 | + |
| 18 | +## Replacements |
| 19 | + |
| 20 | +Some series of text is replaced when creating the different lines to execute. Here is the C# code used for this |
| 21 | +```csharp |
| 22 | +string[] lines = EZText.Replace(".", "|").Split(new[] { '\n', '|' }).Select(x => x.Trim() |
| 23 | + .Replace("is not equal to", "!=") |
| 24 | + .Replace("is not", "!") |
| 25 | + .Replace("is equal to", "equals") |
| 26 | + .Replace(" equals ", " = ") |
| 27 | + .Replace("is greater than or equal to", ">=") |
| 28 | + .Replace("is less than or equal to", "<=") |
| 29 | + .Replace("is greater than", ">") |
| 30 | + .Replace("is less than", "<") |
| 31 | + .Replace(", then ", " then ") |
| 32 | + .Replace(" then ", " : ") |
| 33 | + .Replace("[p]", ".") |
| 34 | + .Replace("[SPACE]", " ") |
| 35 | + ).Where(y => !y.Equals("")).ToArray(); |
| 36 | +``` |
| 37 | + |
| 38 | +## Syntax |
| 39 | +__Directory:__ |
| 40 | +- [Add to list](#add-to-list) |
| 41 | +- [Add to variable](#add-to-variable) |
| 42 | +- [Clear list](#clear-list) |
| 43 | +- [Clear the console](#clear-the-console) |
| 44 | +- [Create list](#create-list) |
| 45 | +- [Create variable](#create-variable) |
| 46 | +- [Delete File](#delete-file) |
| 47 | +- [Destroy List](#destroy-list) |
| 48 | +- [Display messagebox](#display-messagebox) |
| 49 | +- [Divide Variable](#divide-variable) |
| 50 | +- [If](#if) |
| 51 | +- [If not](#if-not) |
| 52 | +- [Math](#math) |
| 53 | +- [Multiply variable](#multiply-variable) |
| 54 | +- [Play](#play) |
| 55 | +- [Remove from list](#remove-from-list) |
| 56 | +- [Replace in list](#replace-in-list) |
| 57 | +- [Split list](#split-list) |
| 58 | +- [Stop](#stop) |
| 59 | +- [Subtract from variable](#subtract-from-variable) |
| 60 | +- [Wait](#wait) |
| 61 | +- [Write to console](#write-to-console) |
| 62 | +- [Write to file](#write-to-file) |
| 63 | +- [Variable equals](#variable-equals) |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +### Add To List |
| 68 | + |
| 69 | +The syntax for this, `Add value to list NAME`. The `NAME` is the name of the list. This will translate to `NAME add value`. |
| 70 | + |
| 71 | +### Add To Variable |
| 72 | + |
| 73 | +The syntax is, `Add value to Var`. `Var` is the name of the variable. This translates to `Var + value`. |
| 74 | + |
| 75 | +### Clear List |
| 76 | + |
| 77 | +The syntax for this, `Clear the list NAME`. The `NAME` is the name of the list. This will translate to `NAME clear`. |
| 78 | + |
| 79 | +### Clear the Console |
| 80 | + |
| 81 | +The syntax is simple for this, `Clear the console`. This will translate to `clear`. |
| 82 | + |
| 83 | +### Create List |
| 84 | + |
| 85 | +The syntax is, `Create a list named NAME` or `Crate a list named NAME with the value(s) VALUE`. The `NAME` is the name of the list and `VALUE` is the value(s) of the list. If just `value`, it will search for the next word. If `values`, it will search for everything after it. It needs to be seperated with commas `,` like in EZCode. For Example, `create a list named List1 with the values of A, B, C`. |
| 86 | + |
| 87 | +### Create Variable |
| 88 | + |
| 89 | +The syntax is, `Create a vcariable named NAME` or `Crate a variable named NAME with the value VALUE`. The `NAME` is the name of the variable and `VALUE` is the value of the variable. To assign the variable to other values, use `of` after `value`. Here are the following values that it can be set to, |
| 90 | +- `of if A intersects B`: This will translate to, `var NAME : intersects A B`. |
| 91 | +- `of if the file FILEPATH exists`: This will translate to, `var NAME : file exists FILEPATH`. |
| 92 | +- `of if the file path FILEPATH is valid`: This will translate to, `var NAME : file validpath FILEPATH`. |
| 93 | +- `of the console input`: This translates to, `var NAME : input console`. |
| 94 | +- `of the current keys being pressed`: This translates to, `var NAME : input key`. |
| 95 | +- `of if KEY is being pressed`: This translates to, `var NAME : input key KEY`. |
| 96 | +- `of the current mouse buttons being pressed`: This translates to, `var NAME : input mouse button`. |
| 97 | +- `of if the BUTTON mouse button is pressed`: This translates to, `var NAME : input mouse button BUTTON`. |
| 98 | +- `of the current mouse position`: This translates to, `var NAME : input mouse position`. |
| 99 | +- `of the current X/Y mouse position`: This translates to, `var NAME : input mouse position X/Y`. |
| 100 | +- `of the current mouse wheel state`: This translates to, `var NAME : input mouse wheel`. |
| 101 | + |
| 102 | +Here is an example, |
| 103 | +``` |
| 104 | +Create a variable named X with the value of the current X mouse position |
| 105 | +``` |
| 106 | + |
| 107 | +### Delete File |
| 108 | + |
| 109 | +The syntax is, `Delete the file FILEPATH`. `FILEPATH` is the file path that is going to be deleted. This will translate to `file delete FILEPATH`. |
| 110 | + |
| 111 | +### Destroy List |
| 112 | + |
| 113 | +The syntax for this, `Destroy NAME`. The `NAME` is the name of the list. This will translate to `destroy NAME`. |
| 114 | + |
| 115 | +### Display Messagebox |
| 116 | + |
| 117 | +The syntax is, `Display TEXT with the title, TITLE via messagebox`. `TEXT` is the text of the messagebox and `TITLE` is the title of the messagebox. This translates to `messagebox TITLE TEXT` |
| 118 | + |
| 119 | +### Divide Variable |
| 120 | + |
| 121 | +The syntax is, `Divide Var by value`. `Var` is the name of the variable. This translates to `Var / value`. |
| 122 | + |
| 123 | +### If |
| 124 | + |
| 125 | +The syntax to this is similar to EZCode, `if argument : code...`. Although, `:` the same as putting `then` or `, then` with the [replacements](#replacements). As an example, `if X is greater than or equal to 20, then X is equal to 50`. This will translate to `if x >= 20 : X = 50`. It can also create variables inside of the if with the followinf syntax, |
| 126 | +- `if A intersects B then CODE`: This will translate to, |
| 127 | + - ``` |
| 128 | + var EZTEXT_GENERATED_VARIABLE : intersects A B |
| 129 | + if 'EZTEXT_GENERATED_VARIABLE' : CODE |
| 130 | + ``` |
| 131 | +- `if the console input is equal to TEXT then CODE`: This will translate to, |
| 132 | + - ``` |
| 133 | + var EZTEXT_GENERATED_VARIABLE : input console |
| 134 | + if 'EZTEXT_GENERATED_VARIABLE' = TEXT : CODE |
| 135 | + ``` |
| 136 | +- `if the contents of the file FILEPATH is equal to TEXT then CODE`: This will translate to, |
| 137 | + - ``` |
| 138 | + var EZTEXT_GENERATED_VARIABLE : file read FILEPATH |
| 139 | + if 'EZTEXT_GENERATED_VARIABLE' = TEXT : CODE |
| 140 | + ``` |
| 141 | +- `if KEY is being pressed then CODE`: This will translate to, |
| 142 | + - ``` |
| 143 | + var EZTEXT_GENERATED_VARIABLE : input key KEY |
| 144 | + if 'EZTEXT_GENERATED_VARIABLE' : CODE |
| 145 | + ``` |
| 146 | +- `if the BUTTON mouse button is being pressed then CODE`: This will translate to, |
| 147 | + - ``` |
| 148 | + var EZTEXT_GENERATED_VARIABLE : input mouse button BUTTON |
| 149 | + if 'EZTEXT_GENERATED_VARIABLE' : CODE |
| 150 | + ``` |
| 151 | +- `if the X/Y mouse position is equal to VALUE then CODE`: This will translate to, |
| 152 | + - ``` |
| 153 | + var EZTEXT_GENERATED_VARIABLE : input mouse position X/Y |
| 154 | + if 'EZTEXT_GENERATED_VARIABLE' = VALUE : CODE |
| 155 | + ``` |
| 156 | +- `if the mouse wheel state is equal to VALUE then CODE`: This will translate to, |
| 157 | + - ``` |
| 158 | + var EZTEXT_GENERATED_VARIABLE : input mouse wheel |
| 159 | + if 'EZTEXT_GENERATED_VARIABLE' = VALUE : CODE |
| 160 | + ``` |
| 161 | +
|
| 162 | +### If Not |
| 163 | +
|
| 164 | +The syntax is, `if not : CODE`. `:` is replaced by `then` or `, then` with the [replacements](#replacements). It is translated to `else : CODE`. It is only used after an [if](#if) and will be executed if it is false. |
| 165 | +
|
| 166 | +### Math |
| 167 | +
|
| 168 | +The syntax is, `VAR = MATH`. `MATH` is any mathematical stuff including Functions. The `=` is the same as `is equal to` or `equals` with [replacement](#replacements). It translates to, `var VAR : math MATH`. |
| 169 | +
|
| 170 | +### Multiply Variable |
| 171 | +
|
| 172 | +The syntax is, `Multiply Var by value`. `Var` is the name of the variable. This translates to `Var * value`. |
| 173 | +
|
| 174 | +### Play |
| 175 | +
|
| 176 | +The syntax is, `play the file/project FILEPATH`. Either use `file` or `project`. It is translated as `file play file/project FILEPATH`. |
| 177 | +
|
| 178 | +### Remove From List |
| 179 | +
|
| 180 | +The syntax is, `Remove INDEX/VALUE in list NAME`. `NAME` is the name of the list and `INDEX/VALUE` is either the index or value that is going to be removed. It is translated to `NAME remove INDEX/VALUE`. |
| 181 | +
|
| 182 | +### Replace In List |
| 183 | +
|
| 184 | +The syntax is, `Replace INDEX with VALUE in list NAME`. `NAME` is the name of the list. `INDEX` is the index of the value that is going ot be replaced with `VALUE`. It is translated to `NAME equals INDEX VALUE`. |
| 185 | +
|
| 186 | +### Split List |
| 187 | +
|
| 188 | +The syntax is `NAME = split by VALUE SPLITTER`. The `=` is the same as `is equal to` or `equals` with [replacement](#replacements). The `NAME` is the name of the list, `VALUE` is the value going to be split, and the `SPLITTER` is the value that is going to split the `VALUE`. It translates to, `NAME split VALUE SPLITTER`. |
| 189 | +
|
| 190 | +### Stop |
| 191 | +
|
| 192 | +The syntax, `Stop the program/file`. Expected either `program` or `file`. Translates to `stop program` or `stop file`. |
| 193 | +
|
| 194 | +### Subtract From Variable |
| 195 | +
|
| 196 | +The syntax is, `Add value from Var`. `Var` is the name of the variable. This translates to `Var - value`. |
| 197 | +
|
| 198 | +### Wait |
| 199 | +
|
| 200 | +The syntax is, `Wait X miliseconds` or `Wait until X is equal to true`. `X` in the first example is a number. In the second example, it is an argument. It translates to, `await X`. |
| 201 | +
|
| 202 | +### Write To Console |
| 203 | +
|
| 204 | +The syntax is, `Write TEXT to the console`. `TEXT` is the text that ias going to be written to the console. It can be more than one word. It translates to, `print TEXT`. |
| 205 | +
|
| 206 | +### Write To File |
| 207 | +
|
| 208 | +The syntax is, `Write TEXT to the file FILEPATH`. `FILEPATH` is the file path and `TEXT` is the text that is going to be written. This will translate to `file write TEXT FILEPATH`. |
| 209 | +
|
| 210 | +### Variable Equals |
| 211 | +
|
| 212 | +The syntax is, `VAR = VALUE`. `VALUE` is the value that the variable is going to be equal to. The `=` is the same as `is equal to` or `equals` with [replacement](#replacements). It translates to, `VAR = VALUE`. |
0 commit comments