Are there any alternatives to drupal_add_js()?
drupal_add_js() allows inline code:

drupal_add_js($your_js, 'inline'):


You should however not rely on it too much. JS can be better cached by the browser (and aggregated with other JS) if delivered in a separate file.