Howdy, Stranger!

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

a way to copy many almost identical object?

2»

Comments

  • I could have used the TwineScript logical OR (or) operator there as well, probably should have (since some people have issues remembering which sigil-style operators are which). Force of habit caused me to use the JavaScript logical OR (||) operator.
  • So to use the OR in an if else, are you saying I can do it either way (or / ||) and I can also use it in JavaScript, TwineScript, and SugarCube?
  • edited June 2015
    In TwineScript you may use either logical OR operator, its own (or) or JavaScript's (||), since TwineScript is just a candy coating over JavaScript.

    In JavaScript you may only use its logical OR operator (||).

    So, which parts are TwineScript and which JavaScript in SugarCube?
    The contents of the <<script>> macro and script sections (i.e. Story JavaScript in Twine 2 and script tagged passages in Twine 1) are evaluated as pure JavaScript. All other script-y bits are evaluated as TwineScript.

    If TwineScript is just a candy coating over JavaScript, what does it add and/or change?
    TwineScript adds wordy operators (e.g. to and is; see <<if>> and <<set>> for more information) and handling of story variables (e.g. $foo).

    So, about JavaScript….
    See: MDN JavaScript Guide & MDN JavaScript Reference.
  • Thank you! Super-insightful.
    :)
Sign In or Register to comment.