Mystic Utilities (MUTIL)
Scripting Custom Modules
Mystic Utilities (MUTIL)
Scripting Custom Modules
This function takes a signed integer and returns the absolute value. Example:
Var Int : LongInt = -1234 WriteLn('The absolute value of '+Int2str(Int) +' is '+Abs(Int)+'.')
Used to turn on arrow key processing in the READKEY function. It is also used outside of MPL so use with caution.
AllowArrow := True ReadKey
This function accepts a bit position and checks it against an integer, returning true or false if the bit is on. So for example in the Records, the third bit in UserFlags is UserDeleted:
GetThisUser If BitCheck(3, UserFlags) Then WriteLn('User is marked deleted');
This procedure accepts a bit position and an integer and sets the bit ON/OFF based on a boolean:
GetThisUser BitSet(3, UserFlags, True); // user is marked as deleted
This procedure accepts a bit position and an integer and toggles the bit.
GetThisUser BitToggle(3, UserFlags); // undeletes if they are deleted or deletes if // they are not deleted.
This function will clear the screen. Example:
CLRSCR Writeln ('The screen was just cleared.')
The above function will clear the screen and write the text “The screen was just cleared.” to the screen.
This function takes a MM/DD/YY format date and converts it to DOS packed datetime format.
Var DStr : String = '01/01/14' Var PDt : LongInt PDt := Date2Dos(DStr)
This function takes a MM/DD/YY format date and converts it to a Julian date format.
This function takes a gregorian date format (MMDDYY) and converts it to a Julian format
This function takes a julian date format and converts it to a gregorian format (MMDDYY).
This procedure will move the cursor to a specified X and Y position on the screen. This only works for users who have ANSI graphics.
CLRSCR GotoXY (1, 10) WriteLn ('Hello')
The above example will clear the screen then goto the first column of the tenth line and output the text “Hello” to the screen.
This procedure will exit the program and return the user back to the BBS immediately.
If Graphics = 0 Do Begin WriteLn ('Sorry, you do not have ANSI graphics.') Halt End
The above example will check to see if the user has ANSI graphics and if not, display “Sorry, you do not have ANSI” and exit the program immediately by using the HALT command.
This function takes a user name and attempts to return one or two character initials.
S := Initials('Jack Phlash'); // should return "JP"
This function gives input to the user, and returns the result of the input as a string variable.
The Field parameter is the size of the input field (in characters) that the user will be able to see. If the field size is smaller than the maximum number of characters allowed in the input, the input line will scroll when the user reaches the end. This field is usually set to the same as the Max parameter.
The Max parameter is the maximum number of characters that Input will allow to be entered. Note that the Field parameter, in most cases, should be set to the same value as this.
The Mode parameter is the type of input that will be accepted, and can be any one of the following input types:
|1||Standard input.||All characters allowed.|
|2||Upper case input.||Allows all characters, but will convert any lower case letters into upper case.|
|3||Proper input.||Allows all characters, but will convert the first letter in each word to an upper case letter.|
|4||Phone input.||Allows only numbers and will pre-format them using the USA-style phone numbers. IE: XXX-XXX-XXXX. Note that the length of this input should always be 12, as that is the length of the USA phone number format.|
|5||Date input.||Allows only numbers and will pre-format them using the date format (ie XX/XX/XX) that is currently selected by the user. NOTE: The date input will always return the date in the MM/DD/YY format, regardless of what format the user has selected. For example, if the user has selected the DD/MM/YY format, Input will expect the user to enter the date in that format, but will then convert it to MM/DD/YY when it returns the date back to the MPE program.|
|6||Password input.||Allows all characters, but will convert any lower case letters into upper case. The character that is typed is NOT echoed to the screen. Instead, it is replaced by the * character so that what they have entered will not be shown on the screen.|
|7||Lower case input.||Allows all characters, but will convert any lower case letters into upper case.|
|8||User Defined.||User name format from sys config|
|9||Standard Input w/o CRLF||Will not append CRLF to input|
|10||Numeric Input.||Will only accept number 0-9 and . , + -|
NOTE: If any of the above input values are increased by 10, Input will create an input field using the foreground/background color that has been defined for that language. For example, input type 11 will function the same as input type 1, but will fill an input field to the maximum field length.
The Default parameter can be used to force a default text into the input field. If you do not wish to have any default text in the buffer, supply a blank string parameter (ie ’’).
Var Str : String Write ('Enter something: ') Str := Input (30, 30, 1, '')
The above example will print the text “Enter something: ” to the screen and the allow input of up to 30 characters in length, using input type 1 (allows all characters). No default text has been supplied so the input field will be empty by default.
Var Str : String Write ('Enter something: ') Str := Input (30, 30, 11, 'Default')
The above example will function just like the first example, except it will create an input field background and stuff the text of “Default” into the input field.