Display dialog from command line (like xmessage does)
One option is to tell a background process like SystemUIServer to display the dialog:

osascript -e 'tell application "SystemUIServer"
display dialog "message"
end
activate application (path to frontmost application as text)'


You can also tell the frontmost application to display a dialog, but it's not shown immediately if the application is not responding. If MPlayer OS X is frontmost, text dialogs don't accept any keyboard input.

osascript -e 'tell application (path to frontmost application as text)
display dialog "message"
end'