GithubHelp home page GithubHelp logo

Comments (4)

ChapelR avatar ChapelR commented on August 10, 2024

$('tw-storydata').attr('ifid') should get you the IFID

from sugarcube-2.

selden avatar selden commented on August 10, 2024

I must be overlooking something and don't how that construct should be used.

I assumed that $ indicates a global variable and naively thought that putting the text you provided into a passage should cause it to display the IFID.

Unfortunately, when I include that string in a passage, all it does is echo the text of that string itself and does not display the IFID.

What don't I understand?

capture_006_13032020_015012

from sugarcube-2.

selden avatar selden commented on August 10, 2024

Update: the EDID [i]is[/i] shown if I enclose the EDID query string in the print macro.

I dunno if it should be considered a bug that the "Naked Variable" construct doesn't work.

from sugarcube-2.

tmedwards avatar tmedwards commented on August 10, 2024

The StoryData compiler special passage is not compiled into the data chunk of Twine 2 style story formats. That said, its data is available within the data chuck in various elements. The information you likely want out of it can be found on the <tw-storydata> element's content attributes.

Console example:

console.log('Story Name:', $('tw-storydata').attr('name'));
console.log('Story IFID:', $('tw-storydata').attr('ifid'));
console.log('Story Format:', $('tw-storydata').attr('format') + " v" + $('tw-storydata').attr('format-version'));
console.log('Compiler:', $('tw-storydata').attr('creator') + " v" + $('tw-storydata').attr('creator-version'));

<<print>> example:

''Story Name:'' <<= $('tw-storydata').attr('name')>>
''Story IFID:'' <<= $('tw-storydata').attr('ifid')>>
''Story Format:'' <<= $('tw-storydata').attr('format') + " v" + $('tw-storydata').attr('format-version')>>
''Compiler:'' <<= $('tw-storydata').attr('creator') + " v" + $('tw-storydata').attr('creator-version')>>

PS: $(…) is an alias for jQuery, not a story variable, so the function call happening there not working with the naked variable markup is not a bug.

from sugarcube-2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.