python_getstarted
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| python_getstarted [2023/01/08 12:02] – g00r00 | python_getstarted [2023/01/20 02:28] (current) – [Getting Started with Scripting] g00r00 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Getting Started with SCripting | + | ===== Getting Started with Scripting |
| //Note: This section assumes you've already performed the installation of | //Note: This section assumes you've already performed the installation of | ||
| Line 10: | Line 10: | ||
| The goal of this section is not to teach you Python, but to show you | The goal of this section is not to teach you Python, but to show you | ||
| how to get started specifically with Mystic' | how to get started specifically with Mystic' | ||
| - | many Python | + | many Python references and tutorials all over the Internet to help develop |
| the skills needed to create your Python programs. | the skills needed to create your Python programs. | ||
| - | scripting language used both at the hobby and professional levels and the | + | scripting language used both at the hobby and professional levels, and the |
| resources available via Google are plentiful. | resources available via Google are plentiful. | ||
| Line 61: | Line 61: | ||
| writeln(" | writeln(" | ||
| writeln(" | writeln(" | ||
| + | |||
| + | |||
| + | Refer to the [[python_functions|function reference]] and [[python_examples|Python examples]] section for more information on Python functions available as part of the Mystic module. | ||
| ---- | ---- | ||
| Line 72: | Line 75: | ||
| Python scripts can be executed from your menus by using the " | Python scripts can be executed from your menus by using the " | ||
| - | command. | + | command |
| - | .mpy files using the same logic that Mystic Programming Language uses. | + | Mystic looks in the theme' |
| + | same logic that Mystic Programming Language uses. | ||
| * If you supply a file with no extension, Mystic will add .mpy to it | * If you supply a file with no extension, Mystic will add .mpy to it | ||
| Line 81: | Line 85: | ||
| For example: | For example: | ||
| - | Menu Command: GY (Execute Python Script) | + | Menu Command: GY (Execute Python |
| Data: testpython | Data: testpython | ||
| Line 87: | Line 91: | ||
| directory if it exists. | directory if it exists. | ||
| same from the default script directory if "theme fallback" | same from the default script directory if "theme fallback" | ||
| + | |||
| + | To execute Python 3, you'd use the GZ menu command instead of GY. | ||
| === By Prompt Replacement === | === By Prompt Replacement === | ||
| Line 96: | Line 102: | ||
| 001 #mypython | 001 #mypython | ||
| - | The above example would execute mypython.mpy from the theme' | + | The above example would execute mypython.mpy |
| directory in place of system prompt #001. | directory in place of system prompt #001. | ||
| + | |||
| + | To execute a Python 3 script from a prompt, use the ~ character instead of # | ||
| === By Command Line === | === By Command Line === | ||
| Mystic Python scripts can be executed directly from the command line by | Mystic Python scripts can be executed directly from the command line by | ||
| - | using the -Y option, but keep in mind a username and password must be | + | using the -Y and -Z options, but keep in mind a username and password must be |
| supplied along with it. For example: | supplied along with it. For example: | ||
| mystic -uSysop -ppassword -ytestpython | mystic -uSysop -ppassword -ytestpython | ||
| | | ||
| - | The above example will execute testpython from the user's theme script | + | The above example will execute |
| directory applying the same logic as defined above for the path/ | directory applying the same logic as defined above for the path/ | ||
| - | conversions in Mystic Python. | + | conversions in Mystic Python. To execute Python 3 script from command line, use -Z |
| + | instead of -Y. | ||
| + | |||
| + | === Through MPL Hooks === | ||
| + | |||
| + | Mystic has hooks in various locations where functionality of Mystic can be completely replaced by MPL scripts, such as the user login and new user application processes. | ||
| + | |||
| + | This type of approach would allow the entire login and new user application process to be completely scripted in Python, for example. | ||
| + | |||
| + | A BBS can range from a completely scripted experience, to a completely customized theme without using any scripting, or anything in between. | ||
python_getstarted.1673200962.txt.gz · Last modified: by g00r00
