Howdy, Stranger!

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

SugarCube (UserLib Clarification)

edited November 2014 in Help! with 1.x
So I'm really enjoying the changes to SugarCube, but while reading the changelog I came across a reference to a "UserLib", which I'm not really understanding. Here's the quote - [quote]Added the ability to build user library code into the compiled HTML via the file userlib.js, which must exist within SugarCube's directory under targets.

So, from my interpretation, custom code can be added to a directory example - "C:ProgramFiles/Twine/Targets/SugarCube/userlib.js". My question would be, what advantage would this have over using just pasting code into a script passage, or using the StoryIncludes to point to a .twee file with your code in it?

Maybe I'm over-thinking but it would be nice to get a little clarification on this if anyone happens to know, or if Exiles happens to read this.

Anyway, thanks for reading!

Comments

  • It's for instances where you want/need to ensure that some code is loaded before the SugarCube module starts.  You'd put that code in userlib.js.  Though, if it's something that's gets grabby with the $ variable, you might need to have jQuery relinquish control of it (i.e. make jQuery.noConflict(); the first line in the file).

    You recall the question you asked about libraries (e.g. MooTools) around the end of September?  That's one of the things you can do with it.
  • TheMadExile wrote:

    It's for instances where you want/need to ensure that some code is loaded before the SugarCube module starts.  You'd put that code in userlib.js.  Though, if it's something that's gets grabby with the $ variable, you might need to have jQuery relinquish control of it (i.e. make jQuery.noConflict(); the first line in the file).

    You recall the question you asked about libraries (e.g. MooTools) around the end of September?  That's one of the things you can do with it.


    Damn! Thanks man! That's what I was hoping, seriously your the best. =)
Sign In or Register to comment.