python_functions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
python_functions [2017/12/30 18:17] – g00r00 | python_functions [2023/01/20 01:57] (current) – [Function List A to Z] g00r00 | ||
---|---|---|---|
Line 3: | Line 3: | ||
This page is a work in progress. | This page is a work in progress. | ||
making changes, and be sure to include anchors from the A-Z list at the | making changes, and be sure to include anchors from the A-Z list at the | ||
- | bottom as well as the table at each section. | + | bottom as well as the table at each section. MPL documentation should follow |
+ | a similar format. | ||
- | Optionally maybe these 4 main sections | + | If you are looking for documentation for a function from the A-Z function |
+ | list at the bottom and it is not yet documented here, do a search at the top | ||
+ | of the site for the function name. All functions | ||
+ | the Whats new sections, and the search may find it for you. | ||
- | MPL documentation should follow this same layout | + | If you have a specific request |
+ | the documentation can be prioritized. If you have a specific request for an | ||
+ | enhancement, | ||
- | 1234567890123456789012345678901234567890123456789012345678901234567890123456789 | + | The examples section, and included example scripts with a new installation of |
+ | Mystic can also be useful when learning the functions. | ||
---- | ---- | ||
==== Output Functions ==== | ==== Output Functions ==== | ||
- | ^ Function | + | ^ Function |
- | | [[python_functions# | + | | [[python_functions# |
- | | [[python_functions# | + | | [[python_functions# |
- | | [[python_functions# | + | | [[python_functions# |
- | | [[python_functions# | + | | [[python_functions# |
+ | | [[python_functions# | ||
+ | | [[python_functions# | ||
+ | | [[python_functions# | ||
+ | |||
+ | === Function: PWRITE === | ||
+ | |||
+ | |||
+ | Syntax: pwrite (string) | ||
+ | |||
+ | This function accepts a string parameter and will send the contents of the | ||
+ | string to the user, processing any pipe color codes properly but ignoring other | ||
+ | MCI codes. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | rwrite(" | ||
+ | |||
+ | The above example will print " | ||
+ | that the MCI code containing the user name was not translated. | ||
+ | |||
+ | === Function: PWRITELN === | ||
+ | |||
+ | Syntax: pwriteln (string) | ||
+ | |||
+ | This function accepts a string parameter and will send the contents of the | ||
+ | string to the user, processing any pipe color codes properly but ignoring other | ||
+ | MCI codes. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | pwriteln(" | ||
+ | |||
+ | The above example will print " | ||
+ | that the MCI code containing the user name was not translated. | ||
=== Function: RWRITE === | === Function: RWRITE === | ||
Line 50: | Line 92: | ||
The above example will print " | The above example will print " | ||
user and then move the cursor to the next line. | user and then move the cursor to the next line. | ||
+ | |||
+ | === Function: SHOWFILE === | ||
+ | |||
+ | Syntax: showfile (filename, baudrate, pause, abort, onlynew) : boolean | ||
+ | | ||
+ | This function accepts the filename string followed by several boolean | ||
+ | options represented as 1 for true or 0 for false. | ||
+ | | ||
+ | The filename parameter can be a base filename such as " | ||
+ | will calculate the file extension based on the user's terminal settings | ||
+ | and random display file system. | ||
+ | Mystic will not attempt to do any calculation based on terminal or | ||
+ | random files. | ||
+ | excluded it will display from the current theme' | ||
+ | a theme that is inherited by the current theme. | ||
+ | | ||
+ | The baudrate parameter contains the baudrate that will be emulated when | ||
+ | the file is displayed, or it can be set to zero for full speed. | ||
+ | baud rate emulation is done by Mystic itself and does not require any | ||
+ | specific terminal compatibility or extension; it works on all terminals | ||
+ | | ||
+ | The pause parameter can be set to 1 to allow screen pausing | ||
+ | | ||
+ | The abort parameter can be set to 1 to allow aborting with spacebar | ||
+ | | ||
+ | The onlynew parameter can be set to 1 to display the file only if its | ||
+ | modification date is newer than the user's last call. | ||
+ | | ||
+ | The showfile function returns a TRUE result if the file was found and | ||
+ | displayed or false if not. | ||
+ | | ||
+ | Example: | ||
+ | | ||
+ | showfile(" | ||
+ | showfile(" | ||
=== Function: WRITE === | === Function: WRITE === | ||
Line 83: | Line 160: | ||
user and then move the cursor to the next line. | user and then move the cursor to the next line. | ||
+ | ---- | ||
==== Input Functions ==== | ==== Input Functions ==== | ||
+ | ^ Function | ||
+ | | [[python_functions# | ||
+ | | [[python_functions# | ||
+ | | [[python_functions# | ||
+ | |||
+ | === Function: GETSTR === | ||
+ | |||
+ | Syntax: getstr (Mode, FieldSize, MaxInput, DefaultText) | ||
+ | | ||
+ | Mode defines how the input is handled: | ||
+ | 1 = Standard input | ||
+ | 2 = Upper case | ||
+ | 3 = Proper | ||
+ | 4 = USA Phone Number | ||
+ | 5 = Date | ||
+ | 6 = Password | ||
+ | 7 = Lower cased | ||
+ | 8 = User defined input | ||
+ | 9 = Standard input with no CRLF | ||
+ | 10 = numbers only (and . + -) | ||
+ | | ||
+ | Adding 10 to this value (ie 1 becomes 11) will cause Mystic to | ||
+ | draw an input field using the input field colors defined for the | ||
+ | current theme. | ||
+ | | ||
+ | FieldSize defines the maximum size of the field. | ||
+ | MaxInput is larger than FieldSize then the input will be | ||
+ | scrolled. | ||
+ | | ||
+ | MaxInput defines the total number of bytes allowed in this | ||
+ | input field. | ||
+ | | ||
+ | DefaultText defines the value that will be put into the input | ||
+ | field by default. | ||
+ | | ||
+ | Example: | ||
+ | | ||
+ | input = getstr(11, 40, 120, " | ||
+ | |||
+ | === Function: KEYPRESSED === | ||
+ | |||
+ | Syntax: keypressed : boolean | ||
+ | | ||
+ | Returns a true if a there is input waiting to be read in from the user | ||
+ | and false if there is no input waiting. | ||
+ | | ||
+ | Example: | ||
+ | | ||
+ | if keypressed is True: | ||
+ | writeln(" | ||
+ | |||
+ | === Function: ONEKEY === | ||
+ | |||
+ | Syntax: onekey (keylist, echo) : string | ||
+ | | ||
+ | This function asks the user to input a character but accepts only input | ||
+ | from the user that matches a character in the keylist. | ||
+ | the function will print the character to the terminal. | ||
+ | | ||
+ | Example: | ||
+ | | ||
+ | ch = onekey(chr(13) + " | ||
+ | | ||
+ | if ch == ' | ||
+ | | ||
+ | | ||
+ | The above example prompts the user to enter one of the keys A, P, Q or | ||
+ | the ENTER key (ASCII #13). Because echo is True, it will prompt the | ||
+ | | ||
+ | |||
+ | User input for this function is not case sensitive. | ||
+ | |||
+ | ---- | ||
==== BBS Data Access Functions ==== | ==== BBS Data Access Functions ==== | ||
+ | ---- | ||
==== Miscellaneous Functions ==== | ==== Miscellaneous Functions ==== | ||
+ | ^ Function | ||
+ | | [[python_functions# | ||
+ | | [[python_functions# | ||
+ | |||
+ | === Function: PARAM_COUNT === | ||
+ | | ||
+ | Syntax: function param_count() : integer | ||
+ | | ||
+ | Returns the number of parameters passed to the script when it was | ||
+ | executed. | ||
+ | | ||
+ | Example: See param_str | ||
+ | | ||
+ | === Function: PARAM_STR === | ||
+ | | ||
+ | Syntax: function param_str(# | ||
+ | | ||
+ | param_str returns the parameter passed to the script, where # is the | ||
+ | parameter number. | ||
+ | name. Supplying nothing will give you the entire command line. | ||
+ | | ||
+ | Example: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | count = 0 | ||
+ | | ||
+ | while count <= bbs.param_count(): | ||
+ | | ||
+ | | ||
+ | count = count + 1 | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | ---- | ||
==== Function List A to Z ==== | ==== Function List A to Z ==== | ||
* access | * access | ||
+ | * acsnogroup | ||
+ | * backspace | ||
* charxy | * charxy | ||
+ | * dated2u | ||
+ | * datestr | ||
+ | * dateu2d | ||
+ | * delay | ||
+ | * find_config | ||
+ | * find_display | ||
+ | * fl_close | ||
+ | * fl_found | ||
+ | * fl_getdesc | ||
+ | * fl_getfile | ||
+ | * fl_open | ||
+ | * fl_prev | ||
+ | * fl_next | ||
+ | * fl_seek | ||
+ | * flush | ||
* getcfg | * getcfg | ||
* getfbase | * getfbase | ||
Line 103: | Line 313: | ||
* getmgroup | * getmgroup | ||
* getmgroupid | * getmgroupid | ||
+ | * getnetaddr | ||
* getprompt | * getprompt | ||
- | * getstr | + | * [[python_functions# |
* getuser | * getuser | ||
* getuserid | * getuserid | ||
* getyn | * getyn | ||
- | * gotoyn | + | * gotoxy |
- | * keypressed | + | * isuser |
+ | * isuserpw | ||
+ | * isvalidpw | ||
+ | * [[python_functions# | ||
+ | * logerror | ||
* mci2str | * mci2str | ||
* menucmd | * menucmd | ||
Line 121: | Line 336: | ||
* msg_prev | * msg_prev | ||
* msg_seek | * msg_seek | ||
- | * onekey | + | * msg_stats |
- | * param_count | + | * [[python_functions# |
- | * param_str | + | * [[python_functions# |
+ | * [[python_functions# | ||
+ | * purgeinput | ||
+ | * [[python_functions# | ||
+ | * [[python_functions# | ||
* [[python_functions# | * [[python_functions# | ||
* [[python_functions# | * [[python_functions# | ||
- | * showfile | + | * setlogininfo |
+ | * setpinfo | ||
+ | * setprompt | ||
+ | * [[python_functions# | ||
* shutdown | * shutdown | ||
* stuffkey | * stuffkey | ||
* sysoplog | * sysoplog | ||
+ | * termsize | ||
* textattr | * textattr | ||
* textcolor | * textcolor |
python_functions.1514679429.txt.gz · Last modified: 2017/12/30 18:17 by g00r00