The following are keyboard input functions for doing simple interactivity directly in the Listener or Mini Listener. All keyboard input functions take input from Mini Listener if Listener is closed, but if it is open, input will always be taken from Listener.
getKBValue [ prompt:<string> ]
The getKBValue() function lets the user enter a MAXScript value into the Listener. The optional prompt: keyword argument takes a string that is displayed in the Listener as a prompt message. Any valid MAXScript expression can be entered into the Listener and is evaluated to become the result of the getKBValue() function. Expressions include the literals for integer, float, string, name, array, point2, point3, and scene object pathnames, or they can be expressions involving math operations and functions, script supplied functions, global variables, etc. You can test the type of value returned using MAXScript's classOf function.
v = getKBValue prompt:"Enter object count:"
if classOf v != integer then
print "Value entered must be an integer"
The user can abort the entry by pressing the ESC key in which case the function returns the special value #escape.
getKBLine [ prompt:<string> ]
getKBChar [ prompt:<string> ]
These functions let the user type characters into the Listener that are returned as a MAXScript string. getKBLine() returns all the characters up until the user presses ENTER, getKBChar() returns each character immediately as it is entered. The user can abort the entry by pressing the ESC key in which case the function returns the special value #undefined.
getKBPoint [ prompt:<string> ]
This function lets the user type in a 3D point in the syntax supported by the pickPoint() function. See the pickPoint() description above for details about the syntax. The function interprets the 3D point as relative to the current active grid construction plane and returns a Point3 in world-coordinates.
The following are system global variables related to the keyboard:
These variables access the current state of the keyboard shift, control, alt and escape keys and return true or false depending on the pressed state of the key at the time the variable is read and are read-only variables.