Most LP muds, Diku muds, telnetd, and some other types of servers send unterminated prompts, that is, prompts that do not end with newline or any other special character. Normally, TF will not display text until a newline is received, so you may not see the prompt until after you press return. But if the %{lp} flag is on, TF will attempt to separate these prompts from normal text and display them correctly.
The recommended way to use the %{lp} flag is to define your worlds with one of the /addlp, /adddiku, or /addtelnet commands. The %{lp} flag will be turned on automatically when you switch to such a world, and turned off for the other predefined world types. See: /addworld.
TF also provides a PROMPT hook, which allows you to tell it what to look for in a prompt. When an unterminated line is received, the PROMPT hook is called immediately. If there is no match, TF will use the timeout method described below (if %{lp} is on). But if there is a matching PROMPT hook, TF will forget about the line (unless the hook was defined with /def -q) and let the hook deal with it. By combining the PROMPT hook with the /prompt command, you can recognize most prompts immediately without having to use the %{lp} timing mechanism. The typical way of doing this is:
/def -h"PROMPT *> " catch_prompt = /test prompt({*})So, whenever TF receives an unterminated line that ends in "> ", catch_prompt will see it, and use /prompt to copy it to the current prompt.
If an unterminated line is not matched by any PROMPT hook, and it is not followed by more text within a short period of time, TF will assume it is a prompt. This method is not foolproof. If the delay is too short, broken lines will look like prompts, and will briefly appear in the input window until the rest of the line arrives, at which time both parts of the line will be printed as normal output. If the delay is too long, there will be an annoying delay before displaying real prompts.
The delay can be varied by setting the variable prompt_wait. Its default value is 0.25 seconds.
All of this hackery can be avoided if the server sends unambiguous prompts. TF will recognize "*\b" (that is, "*" followed by backspace) and anything ending with GOAHEAD or END-OF-RECORD telnet characters. When TF sees such text, it does not wait for a delay, but calls the PROMPT hook immediately; if there is no match, TF displays the prompt immediately. To avoid some minor glitches, you should leave the %{lp} flag off when connected to such a server. If you are responsible for a server and wish to make it more TF-friendly, see "prompt protocol".
See also: %login, prompt protocol, /addworld