Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Using external JavaScript library? Twine 2 + snowman

Hi. I'm playing around with Twine 2 and snowman.

Is there a clever way to put functionality (a bunch of javascript methods, mostly) in an external javascript library, and/or link in an external lib? I could fork snowman, modify that, and use it as a new format, and perhaps that is the way to do it. Or is there a better way?

Comments

  • Snowman includes jQuery, so you could use jQuery's ajax script loader to load an external script from your story javascript.
  • Oh, of course. I'll give that a try. Thanks!
  • Update: I did give it a try, and it does work. Of course it adds a “runtime” dependency that seems a little silly, it would maybe be better to bundle it with the built story. I guess that would require a modified story format.



  • There's always the option of dumping the whole script into your story javascript.
  • Yes, that's maybe the easiest way to handle it. I just liked the idea of being able to do stuff in an "extension" library format.
Sign In or Register to comment.