I am not sure how exactly you can emulate the chat bar in v3.1, but in v4 it should be quite easy since also the default chatbar is scripted there. You do ChatBar.destroy and then do something like this:
PHP Code:
function onKeypressed(keycode,keytext) {
if (keycode==9)
MyChatBar.show();
}
The only thing that you canot do currently with script is to let the chat text stay over the head until you move. When the chat text is modified by script it always disappears after a few seconds.