Using the C:XXX feature, you can define a command that displays a simple message.
(defun C:HELLO () (princ "Hello world. \n") (princ)) C:HELLO
HELLO is now defined as a command, in addition to being an AutoLISP function. This means you can issue the command from the AutoCAD Command prompt.
Command: hello
Hello world.
This new command can be issued transparently because it does not call the command function itself. At the AutoCAD Command prompt, you could do the following:
Command: line
From point: 'hello
Hello world.
From point:
Remember: to run this function from the VLISP Console window, you need to issue the function call with the parentheses because VLISP does not recognize AutoCAD commands.
(c:hello) Hello world.
If you follow your function definition with a call to the setfunhelp function, you can associate a Help file and topic with a user-defined command. When help is requested during execution of the user-defined command, the topic specified by setfunhelp displays.
You cannot usually use an AutoLISP statement to respond to prompts from an AutoLISP-implemented command. However, if your AutoLISP routine makes use of the initget function, you can use arbitrary keyboard input with certain functions. This allows an AutoLISP-implemented command to accept an AutoLISP statement as a response. Also, the values returned by a DIESEL expression can perform some evaluation of the current drawing and return these values to AutoLISP. See About Keyword Options (AutoLISP) for more information on using initget.