User Tools

Site Tools


python_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
python_functions [2020/09/12 17:00] g00r00python_functions [2023/01/20 01:57] (current) – [Function List A to Z] g00r00
Line 3: Line 3:
 This page is a work in progress.  Please follow this format closely if This page is a work in progress.  Please follow this format closely if
 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 should be their own page I am open +If you are looking for documentation for a function from the A-Z function 
-to suggestionalthough I worked hard to come up with system where all of +list at the bottom and it is not yet documented heredo search at the top 
-this information could be viewed and accessed quickly as it grows within a +of the site for the function name.  All functions should be documented in 
-single page.+the Whats new sections, and the search may find it for you.
  
-MPL documentation should follow this same layout for consistency.+If you have a specific request for something to be added here, please ask and 
 +the documentation can be prioritized If you have a specific request for an 
 +enhancement, please request it!
  
-1234567890123456789012345678901234567890123456789012345678901234567890123456789+The examples section, and included example scripts with a new installation of 
 +Mystic can also be useful when learning the functions.
  
 ---- ----
Line 91: Line 95:
 === Function: SHOWFILE === === Function: SHOWFILE ===
  
-    Syntax: showfile (filename, baudrate, allowpauseallowabort, onlynew) : boolean+    Syntax: showfile (filename, baudrate, pauseabort, onlynew) : boolean
          
     This function accepts the filename string followed by several boolean     This function accepts the filename string followed by several boolean
Line 105: Line 109:
          
     The baudrate parameter contains the baudrate that will be emulated when     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.+    the file is displayed, or it can be set to zero for full speed.  The 
 +    baud rate emulation is done by Mystic itself and does not require any 
 +    specific terminal compatibility or extension; it works on all terminals
          
-    The allowpause parameter can be set to 1 to allow screen pausing+    The pause parameter can be set to 1 to allow screen pausing
          
-    The allowabort parameter can be set to 1 to allow aborting display +    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     The onlynew parameter can be set to 1 to display the file only if its
Line 156: Line 162:
 ---- ----
 ==== Input Functions ==== ==== Input Functions ====
 +
 +^ Function                                             ^ Description                                          ^
 +| [[python_functions#Function: GETSTR|getstr]]         | Get string input from the user                   |
 +| [[python_functions#Function: KEYPRESSED|keypressed]] | Check if input is available from user            |
 +| [[python_functions#Function: ONEKEY|onekey]]         | Get constrained single character input from user |
 +
 +=== 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.  If the
 +    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, "Default")
 +
 +=== 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("A key is waiting!")
 +
 +=== 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.  If echo is True
 +    the function will print the character to the terminal.
 +            
 +    Example:
 +  
 +      ch = onekey(chr(13) + "APQ", True);
 +      
 +      if ch == 'A':
 +           writeln("User pressed A")
 +      
 +     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
 +     character to the terminal before returning the key that was pressed.
 +     
 +     User input for this function is not case sensitive.
  
 ---- ----
Line 162: Line 240:
 ---- ----
 ==== Miscellaneous Functions ==== ==== Miscellaneous Functions ====
 +
 +^ Function                                         ^ Description                                          ^
 +| [[python_functions#Function: PARAM_COUNT|param_count]] | Return number of script execution parameters   |
 +| [[python_functions#Function: PARAM_STR|param_str]]     | Return script execution parameters             |
 +
 +=== 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(#) : string
 +  
 +  param_str returns the parameter passed to the script, where # is the
 +  parameter number.  Supplying (0) will give you the script location and
 +  name.  Supplying nothing will give you the entire command line.
 +  
 +  Example:
 +  
 +     import mystic_bbs as bbs;
 +  
 +     bbs.writeln ("Number of parameters..: " + str(bbs.param_count()))
 +     bbs.writeln ("Full command line.....: " + bbs.param_str())
 +     bbs.writeln ("Script name...........: " + bbs.param_str(0))
 +     bbs.writeln ("|CRParameters (param_str):|CR")
 +  
 +     count = 0
 +  
 +     while count <= bbs.param_count():
 +       bbs.writeln ("   Param #" + str(count) + ": " + bbs.param_str(count))
 +  
 +       count = count + 1
 +  
 +     bbs.writeln("|CR|PA")
 +  
  
 ---- ----
Line 174: Line 292:
   * dateu2d   * dateu2d
   * delay   * delay
 +  * find_config
 +  * find_display
   * fl_close   * fl_close
   * fl_found   * fl_found
Line 195: Line 315:
   * getnetaddr   * getnetaddr
   * getprompt   * getprompt
-  * getstr+  * [[python_functions#Function: GETSTR|getstr]]
   * getuser   * getuser
   * getuserid   * getuserid
   * getyn   * getyn
   * gotoxy   * gotoxy
-  * keypressed+  * isuser 
 +  * isuserpw 
 +  * isvalidpw 
 +  * [[python_functions#Function: KEYPRESSED|keypressed]]
   * logerror   * logerror
   * mci2str   * mci2str
Line 214: Line 337:
   * msg_seek   * msg_seek
   * msg_stats   * msg_stats
-  * onekey +  * [[python_functions#Function: ONEKEY|onekey]] 
-  * param_count +  * [[python_functions#Function: PARAM_COUNT|param_count]] 
-  * param_str+  * [[python_functions#Function: PARAM_STR|param_str]]
   * purgeinput   * purgeinput
   * [[python_functions#Function: PWRITE|pwrite]]   * [[python_functions#Function: PWRITE|pwrite]]
Line 222: Line 345:
   * [[python_functions#Function: RWRITE|rwrite]]   * [[python_functions#Function: RWRITE|rwrite]]
   * [[python_functions#Function: RWRITELN|rwriteln]]   * [[python_functions#Function: RWRITELN|rwriteln]]
 +  * setlogininfo
   * setpinfo   * setpinfo
   * setprompt   * setprompt
Line 228: Line 352:
   * stuffkey   * stuffkey
   * sysoplog   * sysoplog
 +  * termsize
   * textattr   * textattr
   * textcolor   * textcolor
python_functions.1599948058.txt.gz · Last modified: 2020/09/12 17:00 by g00r00

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki