|
3 | 3 |
|
4 | 4 | This format was made specifically for [BastionCMD](https://www.github.com/BastionMC/BastionCMD), but you can use it in any of your own programs! It's in plain-text, so you don't need to worry about writing the files in any special programs. |
5 | 5 |
|
| 6 | +<h1 align="center"><img image-rendering="pixelated" height="24px" width="24px" src="graphics/Installation.png">Installation</h1> |
| 7 | + |
| 8 | +1. Select the `cticf.py` file from the source of the latest release. |
| 9 | +2. Put the file in the same folder as your main Python file. |
| 10 | +3. Import `cticf`: |
| 11 | +```py |
| 12 | +import cticf |
6 | 13 | ``` |
7 | | - $$ : Text gets inserted by the program here |
8 | | - |
9 | | - §§[r|g|y|b|m|c|w,0][d|n|b][f,b] : The text color will |
10 | | - be changed by this! |
11 | | - |
12 | | - [red,green,yellow,blue,magenta,cyan,white,black] |
13 | | - [dim,normal,bright] |
14 | | - [foreground,background] |
15 | | - |
16 | | - (Only pick one of the letters in |
17 | | - the list! For sample "§§rnf"!) |
18 | | - |
19 | | - §$ : Reset text color |
20 | | - |
21 | | - $§ : Split text segments |
22 | | -
|
23 | | - ────────────────────────────────────────────────────────────── |
24 | | -
|
25 | | - Texts are referred to by index! If you add anything, |
26 | | - please do that at the bottom! It saves a lot of time, |
27 | | - trust me. |
28 | | - |
29 | | - There is a chance your syntax will get misread by the |
30 | | - interpreter. To avoid this, leave a space inbetween |
31 | | - each control-character-combination ($$,§§,§$,$§). |
32 | | - |
33 | | - The interpreter allows for unecessary whitespaces to |
34 | | - be inbetween the different strings, as it will get |
35 | | - trimmed. If you want the whitespace formatting, you |
36 | | - will have to do that through code, sorry. |
37 | | - |
38 | | - Please pay attention to the line length when adding |
39 | | - texts! To follow the style, use a maximum of 64 chars |
40 | | - per line! |
41 | | - |
42 | | - ────────────────────────────────────────────────────────────── |
43 | | - |
44 | | - https://www.github.com/BastionMC/CTICF-Filetype |
| 14 | +6. **You're done, the setup process is complete.** |
| 15 | + |
| 16 | +<h1 align="center"><img image-rendering="pixelated" height="24px" width="24px" src="graphics/How_to_use.png">How to use</h1> |
| 17 | +Here's how you can write in this format, and how to use it. Almost everything you want to know is explained here. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +**Formatting Characters** |
| 22 | + |
| 23 | +The formatting characters consist of the dollar sign, `$`, and the paragraph symbol, `§`. A combination of the two symbols is used for every formatting character combination. Here's all the combinations that you can use: |
| 24 | + |
| 25 | +1. $$ - This combination is used as an insertion point for text. It does not have any arguments. |
| 26 | +2. §§ - This combination is used for changing the text color. It has three arguments: the color, the brightness, and the ground. The color can be `r|g|y|b|m|c|w|0`, standing for red, green, yellow, blue, magenta, cyan, white & black. The brightness can be set to `d|n|b` (meaning dim, normal & bright). The ground is either the foreground or the background, so that's `f|b`. |
| 27 | +3. §$ - Reset's the text color back to the terminals default text color, if needed. |
| 28 | +4. $§ - Different strings get split at this character. |
| 29 | + |
| 30 | +--- |
| 31 | +
|
| 32 | +**Comments** |
| 33 | +
|
| 34 | +Guess what? You can comment the beginning of files! Just write a `#` in it's own seperate line to indicate that the actual file stuff starts from there. |
45 | 35 | |
46 | | - ────────────────────────────────────────────────────────────── |
| 36 | +--- |
| 37 | +
|
| 38 | +**Reading a file** |
47 | 39 |
|
48 | | - You can comment the beginning of files! Use a Hashtag to |
49 | | - indicate that the actual data is starting. Do not use it |
50 | | - multiple times in a file, or else only the parts after the |
51 | | - last hashtag will get read! |
| 40 | +Once you imported CTICF, reading a file is really easy. You can simply read a file with the following code: |
52 | 41 |
|
53 | | -# |
| 42 | +```py |
| 43 | +import cticf |
| 44 | +
|
| 45 | +ui_strings = cticf.rfile("path/to/file.cticf") |
| 46 | +ui_string = ui_strings[0] |
| 47 | +
|
| 48 | +print(ui_string) |
54 | 49 | ``` |
| 50 | +
|
| 51 | +This function will return a list with all of your formated strings. You can just print the strings, and they should be formatted. If you want to insert text, the following how-to might be helpful to you: |
| 52 | +
|
| 53 | +--- |
| 54 | +
|
| 55 | +**Inserting text** |
| 56 | +
|
| 57 | +After you've read a file, you can insert text into one of the indexed strings, and print that string to the console: |
| 58 | +
|
| 59 | +```py |
| 60 | +import cticf |
| 61 | +
|
| 62 | +ui_strings = cticf.rfile("path/to/file.cticf") |
| 63 | +ui_string = ui_strings[0] |
| 64 | +ui_string = cticf.inserts(ui_string, "Hello World!") |
| 65 | +
|
| 66 | +print(ui_string) |
| 67 | +``` |
| 68 | +
|
0 commit comments