This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
crpl:overview [2018/06/15 18:15] – added "how to open command in wiki" explanation kajacx | crpl:overview [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | |||
- | < | ||
< | < | ||
- | ===== CRPL - The Language ===== | + | ====== CRPL - The Language |
- | CRPL (**< | + | CRPL (**< |
- | CRPL programming is similar to programming a HP calculator or Forth language programming. If this is not something you have done, read on for a brief introduction to CRPL and stack-based programming. <note>For a more detailed CRPL explanation, | + | CRPL programming is similar to programming a HP calculator or Forth language programming. If this is not something you have done, read on for a brief introduction to CRPL and stack-based programming. <WRAP info>For a more detailed CRPL explanation, |
Each CRPL instruction (term) uses one or more arguments that are on a " | Each CRPL instruction (term) uses one or more arguments that are on a " | ||
Line 22: | Line 20: | ||
< | < | ||
- | <note> | + | <WRAP info>You can find more commands and detailed explanations of them in the [[crpl: |
- | You can find more commands and detailed explanations of them in the [[crpl: | + | |
- | </note> | + | |
- | ==== Comments ==== | + | ===== Comments |
Adding comments makes code easier to understand, and sometimes helps the programmer or another reader to grasp complex pieces of logic. Also, after some time interval, it refreshes one's memory about exactly what a certain piece of code was intended to do. | Adding comments makes code easier to understand, and sometimes helps the programmer or another reader to grasp complex pieces of logic. Also, after some time interval, it refreshes one's memory about exactly what a certain piece of code was intended to do. | ||
Line 40: | Line 36: | ||
2 4 5 add # adds 4 and 5 to get 9</ | 2 4 5 add # adds 4 and 5 to get 9</ | ||
- | ==== Stack Notation ==== | + | ===== Stack Notation |
Every CRPL operand takes zero or more arguments from a " | Every CRPL operand takes zero or more arguments from a " | ||
Line 66: | Line 62: | ||
|< 80% 15% >| | |< 80% 15% >| | ||
|b |**Boolean** ; nominally a 1 or a zero, representing True or False| | |b |**Boolean** ; nominally a 1 or a zero, representing True or False| | ||
- | |i |**Integer** ; an integer. The CRPL run-time will, if possible, convert the argumant | + | |i |**Integer** ; an integer. The CRPL run-time will, if possible, convert the argument |
|n |**Term** ; a generic argument. Any term that will be accepted by the instruction. If possible, the CRPL run-time will attempt conversion between types.| | |n |**Term** ; a generic argument. Any term that will be accepted by the instruction. If possible, the CRPL run-time will attempt conversion between types.| | ||
|f |**Float** ; a floating point value. If possible, the CRPL run-time will attempt conversion between types.| | |f |**Float** ; a floating point value. If possible, the CRPL run-time will attempt conversion between types.| | ||
Line 73: | Line 69: | ||
|s |**String** ; a string of one or more text characters. If possible, numeric values will be converted at run-time.| | |s |**String** ; a string of one or more text characters. If possible, numeric values will be converted at run-time.| | ||
- | ==== Warp Notation ==== | + | ===== Warp Notation |
An extra and optional operator to CRPL allows for a reversed order that you write some things in CRPL. It doesn' | An extra and optional operator to CRPL allows for a reversed order that you write some things in CRPL. It doesn' | ||
Line 146: | Line 142: | ||
</ | </ | ||
- | ==== Typographical conventions ==== | + | ===== Typographical conventions |
**Note:** FIXME This has not yet been implemented. We intend to, but until then the following is merely a placeholder. | **Note:** FIXME This has not yet been implemented. We intend to, but until then the following is merely a placeholder. | ||
Line 156: | Line 152: | ||
|User | |User | ||
- | ==== Creating CRPL Scripts ==== | + | ===== Creating CRPL Scripts |
- | Any text editor can be used to edit CRPL files. However, syntax highlight and auto completion support files are provided for the freely | + | Any text editor can be used to edit CRPL files. However, syntax highlight and auto completion support files are provided for several |
- | [[http:// | + | |
- | | + | <WRAP info>See how others created their maps! You can extract the CRPL scripts and custom images from any CW3 game file. The guide to [[examine map resources]] will show you how to retrieve these resources from other maps.</ |
+ | |||
+ | ==== Notepad++ ==== | ||
+ | |||
+ | Notepad++ can be obtained from here: [[https:// | ||
+ | < | ||
+ | | ||
+ | * Light theme: [[crpl: | ||
+ | * Deep Black theme: [[crpl: | ||
+ | * Download either (or both) of those files, then: | ||
* Open Notepad++, | * Open Notepad++, | ||
+ | |||
+ | |||
*You can add **keyword auto completion** to Notepad++ by download this file [[CRPL.xml]] | *You can add **keyword auto completion** to Notepad++ by download this file [[CRPL.xml]] | ||
- | * To install into Notepad++ you need to copy CRPL.xml to your Notepad++ install | + | * To install into Notepad++ you need to copy CRPL.xml to the '' |
- | * Alternatively, | + | * Alternatively, |
- | * Use the same process to install as above. To see the description of the command, type opening bracket " | + | * Use the same process to install as above. To see the description of the command, type the opening bracket " |
* You can also create a keyboard shortcut to open the wiki of the current command you have your cursor on. | * You can also create a keyboard shortcut to open the wiki of the current command you have your cursor on. | ||
- | * In Notepad++, go into "Run -> Run", then type '' | + | * In Notepad++, go into "Run -> Run", then type '' |
+ | |||
+ | ==== Visual Studio Code ==== | ||
+ | |||
+ | Visual Studio Code can be obtained from here: [[https:// | ||
+ | |||
+ | Features: | ||
+ | * Syntax Highlighting | ||
+ | * Looking stuff up on the wiki | ||
+ | * Syntactical diagnostics | ||
+ | * Implements several VSCode features for named entities (variables/ | ||
+ | * Checks to make sure variables are used (written to at least once and read from at least once) | ||
+ | |||
+ | Instructions: | ||
+ | |||
+ | * Download this *.vsix file: [[https:// | ||
+ | * In Visual Studio Code, Go to View -> Extensions. | ||
+ | * In the menu that opens, expand the more options menu in top right and press Install from VSIX, then point to the downloaded file. | ||
+ | * All files with the *.crpl extension will now automatically utilize the features above. | ||
+ | |||
+ | ==== Sublime Text ==== | ||
+ | |||
+ | Sublime Text can be obtained from here: [[https:// | ||
+ | |||
+ | Features include syntax highlighting and auto completion. | ||
+ | |||
+ | Instructions: | ||
+ | |||
+ | * In Sublime Text, go to Tools -> Command Palette. | ||
+ | * Type " | ||
+ | * Open the Command Palette again and type " | ||
+ | * In the menu that opens, type " | ||
+ | * All files with the *.crpl extension should now use this package. | ||
+ | |||
+ | =====Translation Front-ends ===== | ||
+ | |||
+ | * Forum user [[https:// | ||
+ | |||
+ | * Discord user Redcrafter# | ||
+ | |||
+ | Time permitting, this deserves a more complete treatment and probably a section of it's own. | ||
- | < | ||
\\ | \\ | ||
\\ | \\ | ||
- | FIXME / DELETEME | + | |
=====Syntax Highlighting in the Wiki ===== | =====Syntax Highlighting in the Wiki ===== | ||
Dokuwiki uses [[http:// | Dokuwiki uses [[http:// | ||
+ | |||
+ | Code examples can be highlighted using the `4rpl` code tag eg: | ||
+ | |||
+ | <code 4rpl> | ||
+ | # --Volcano-- 5/13/2020 12:58:29 PM | ||
+ | |||
+ | $$POSX:154 | ||
+ | $$POSZ:98 | ||
+ | $$AMT:100 | ||
+ | |||
+ | if (GetGameUpdateCount 3600 % eq0) | ||
+ | true -> | ||
+ | endif | ||
+ | |||
+ | if (< | ||
+ | @Erupt | ||
+ | endif | ||
+ | |||
+ | if (< | ||
+ | 240 -> | ||
+ | true -> | ||
+ | endif | ||
+ | |||
+ | if (< | ||
+ | @OrbsErupt | ||
+ | endif | ||
+ | |||
+ | :Erupt | ||
+ | if (< | ||
+ | do(2 -1) | ||
+ | do(2 -1) | ||
+ | AddCreeper(< | ||
+ | loop | ||
+ | loop | ||
+ | endif | ||
+ | < | ||
+ | if (< | ||
+ | false -> | ||
+ | 0 -> | ||
+ | endif | ||
+ | |||
+ | :OrbsErupt | ||
+ | V3(RandFloat 0.5 - 1 * 2 RandFloat 0.5 - 1 *) -> | ||
+ | CreateOrb(V3(154 randint(-1 2) + 15 98 randint(-1 2) +) < | ||
+ | < | ||
+ | |||
+ | :once | ||
+ | Table( " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ |