1. 14 Apr, 2019 1 commit
  2. 12 Apr, 2019 2 commits
  3. 20 Mar, 2019 1 commit
    • Leon Arnott's avatar
      Fixed a bug where the new SessionStorage system would interfere with the "test... · f9a05b96e8f3
      Leon Arnott authored
      Fixed a bug where the new SessionStorage system would interfere with the "test story starting here" feature in Twine debugging.
      
      Now, that feature is ignored if the debug option is enabled.
      
      Also, if the (loadgame:) macro encounters an error while loading save data (such as, a passage it refers to no longer exists in this version of the story) then a user-facing prompt() will appear suggesting that the save data might be outdated, and asking the reader whether or not the save data should be deleted. It's expected that this message should only appear during story testing, or when upgrading to later versions of a story.
      f9a05b96e8f3
  4. 10 Jan, 2019 1 commit
  5. 26 Nov, 2018 1 commit
  6. 05 Nov, 2018 1 commit
    • Leon Arnott's avatar
      Now, State automatically stores a serialisation of the game state in... · 5b64934ddfca
      Leon Arnott authored
      Now, State automatically stores a serialisation of the game state in SessionStorage, to be restored once the page reloads.
      
      This means that reloading the page (without closing the window or tab) should also automatically reload the player's position in the story, as if by (load-game:). This does not apply when using (reload:), however, which always returns the story to the beginning.
      
      Closes #152.
      5b64934ddfca
  7. 04 Oct, 2018 2 commits
  8. 01 Oct, 2018 1 commit
    • Leon Arnott's avatar
      Fixed the arithmetic operators being right-associative instead of... · e189559b03da
      Leon Arnott authored
      Fixed the arithmetic operators being right-associative instead of left-associative, and gave unary + and - the correct precedence.
      
      This required some non-trivial wrangling with the compiler, especially regarding the unary + and -, so I hope the tests are enough to guarantee stability.
      
      Also fixed some JSHint errors in the previous commit. Closes #138. Closes #149.
      e189559b03da
  9. 21 Sep, 2018 1 commit
    • Leon Arnott's avatar
      Lambda macros that accept multiple values no longer error if no values are given after the lambda. · 935c00a5abf1
      Leon Arnott authored
      The macros are (all-pass:), (some-pass:), (none-pass:), (find:), and (altered:). (folded:) is not included. The values returned by (all-pass:), (some-pass:) and (none-pass:) getting no values are in accordance with Haskell and other FP libraries for JavaScript.
      
      Closes #145.
      
      Also fixed a bug where having a (for:) macro's lambda's "where" clause return something other than a boolean, such as in (for: each _a where 127)[], wouldn't produce an error message.
      935c00a5abf1
  10. 03 Sep, 2018 1 commit
    • Leon Arnott's avatar
      Temp variables finally work correctly with changers that defer a hook. · 338f69a306c6
      Leon Arnott authored
      Now, you can reference temp variables inside the hook, such as in (link:"Read")[It reads: _engraving], just as you can with other kinds of changers.
      
      Additionally:
      
       * Error messages should now explain in slightly more detail what kind of lambda a macro requires ("a 'where' macro", for instance).
       * The "undo" and "redo" buttons' CSS opacity has been reduced, to better fit the default dark theme.
       * Fixed a number of macros that shouldn't have been made into commands, like (prompt:) or (save-game:).
      
      As a result of that last point, three macros that used to return { earlyExit: 1 }, (save-game:), (goto-url:) and (reload:), no longer do, because Section.runExpression no longer recognises that as a valid return value outside of attachables with TwineScript_Run() (which (goto:) is a part of). I ought to fix this at some later point, though the low traffic of those three makes this a low priority.
      338f69a306c6
  11. 27 Jul, 2018 1 commit
  12. 15 Jul, 2018 1 commit
    • Leon Arnott's avatar
      Added a (link-show:) macro, a link which, when clicked, shows hidden hooks as if by (show:). · 5d07061c3b3e
      Leon Arnott authored
      I'm really conflicted on whether this should be a combination of (link-reveal:) or (link-replace:) - that is, whether the link text, when clicked, should unlink or disappear. I've gone with the former for now because I suspect the writing style it would afford - links within sentences, rather than links as single "commands" - is more popular for most Twine authors.
      
      Also, having noticed that a bug prevents (show:) from throwing errors when made to show an already visible hook, I decided to make that the intended behaviour and amend the documentation.
      5d07061c3b3e
  13. 14 Jul, 2018 1 commit
  14. 13 Jul, 2018 1 commit
    • Leon Arnott's avatar
      Fixed the (replace:), (append:) and (prepend:) macros to now consistently no... · 39dc7cdb8cfc
      Leon Arnott authored
      Fixed the (replace:), (append:) and (prepend:) macros to now consistently no longer target any hooks or text that haven't been rendered yet.
      
      While I hadn't originally intended this restriction to exist when designing these macros, I've found it's necessary to obviate complicated implementation issues (such as whether replacing unrendered hooks should permit their replaced code to run before it's replaced, whether (hook:) attached unrendered hooks can be targeted, and more), as well as unpleasant edge-case behaviour (such as what two (replace:) attached hooks targeting each other would do). This solution, at least, can be reasoned about in the same manner as (set:).
      39dc7cdb8cfc
  15. 11 Jul, 2018 1 commit
    • Leon Arnott's avatar
      Renamed "HookCommands" back to just Commands, and reworded the documentation... · 452a47bf995b
      Leon Arnott authored
      Renamed "HookCommands" back to just Commands, and reworded the documentation for those commands that can't have changers attached.
      
      My reasoning is that the commands that can't have attachments are generally self-evident - (enchant:), (load-game:), (goto-url:), etc. have no obvious entity or effect to be styled - so leaving them as special cases shouldn't be too onerous.
      
      Also changed (show:) to be a HookCommand (that is, it can have changers attached).
      452a47bf995b
  16. 10 Jul, 2018 1 commit
  17. 09 Jul, 2018 1 commit
  18. 08 Jul, 2018 1 commit
  19. 06 Jul, 2018 1 commit
    • Leon Arnott's avatar
      Finished implementing (cycling-link:) and VarBind. · b22700969a1c
      Leon Arnott authored
      I'm still not 100% confident on the "bind" keyword, but I guess this is what I'm sticking with.
      
      You may notice that a VarBind stores a VarRef, which contains a variable name and property chain, but afterward one can then alter the variable from under it, so that a property chain for a datamap is now applied to an array. canSet() in varref.js has some provisions to make these not much of a hassle, but I changed it so that internally, VarRefs' property chains now store array indexes as numbers instead of strings, so that they might be distinguished from datamap names. This isn't ideal at all, but for now it produces user-facing errors when it should.
      
      Working on this implementation leaves me with a few additional questions:
      
       * Whether (cycling-link:) rejecting an empty link text should be universalised to the other link macros.
      
       * Whether (t8n:) attached to a (cycling-link:) causing it to transition in on passage start is a problem. (Should it follow how (link:) interacts with t8n?)
      b22700969a1c
  20. 27 Jun, 2018 1 commit
  21. 26 Jun, 2018 1 commit
  22. 23 Jun, 2018 1 commit
  23. 21 Jun, 2018 1 commit
  24. 20 Jun, 2018 1 commit
    • Leon Arnott's avatar
      Implemented (transition-depart:) and (transition-arrive:) as a means to change... · 26cc772ce58b
      Leon Arnott authored
      Implemented (transition-depart:) and (transition-arrive:) as a means to change the passage transitions used by links.
      
      (t8n-depart:) and (t8n-arrive:) only have an effect when affixed to (link-goto:) and (link-undo:) (as well as when (enchant:?Link) targets those entities) and alter the between-passage transitions of those links. Fortunately, the existing transitions' code didn't need to be adjusted to work with passages. The terms "depart" and "arrive" may be a little long, but I like how unambiguously they convey the idea of travel between passages.
      
      Also added "instant" as a valid transition name.
      26cc772ce58b
  25. 10 Jun, 2018 1 commit
  26. 26 May, 2018 1 commit
    • Leon Arnott's avatar
      Implemented HookCommands, and converted a few macros to use their API. · 6bd997b33a40
      Leon Arnott authored
       * Commands now, contrary to previous plans, have a TwineScript_Run() that is separate from TwineScript_Print(). This is to clarify Harlowe's expression-printing logic and differentiate what exactly printing a data expression produces (currently, always a string of markup or a TwineError, with no side effects) vs. what running a command produces (either an earlyExit signal object or a ChangeDescriptor to permute the <tw-expression>, plus side effects). This forces one breaking change: (print:) no longer runs commands passed into it, instead merely printing a basic string representation.
      
       * (print:), (display:) and (link-goto:) are currently reimplemented as HookCommands, but they don't fully utilise their ChangeDescriptors yet.
      
       * Additionally, Macros now has addCommand(), which centralises the "command constructor" macro pattern. All other command macros' definitions (except for the (set:) bunch, whose commands need TwineScript_Unobservable) have been changed to use it.
      6bd997b33a40
  27. 18 May, 2018 1 commit
    • Leon Arnott's avatar
      Added infrastructure for "hook commands", a command which can have changers... · 04f96b39de1f
      Leon Arnott authored
      Added infrastructure for "hook commands", a command which can have changers attached, as well as the "bind" datatype.
      
       * "bind" is a new unary operator designed to pass variables by reference to certain upcoming input element macros, like (cycling-link:). This solves, with some brutality, the long-standing issue of not being able to pass in variables by reference to macros, which was always necessary to add these much-sought macros to Harlowe. Try as I might to think of some less blunt way to specify this syntactically, I must now in my increasing age defer to this solution.
      
       * "hook commands" will be ordinary commands (which have a TwineScript_Print() method) but also have a TwineScript_Attach() method that allows changers to mutate it in-place before it's finally printed. This will solve the long-standing issue of not being able to attach (t8n:) macros, and other valuable changers, to links and (goto:) macros.
      
       * Also fixed a few minor issues here and there.
      04f96b39de1f
  28. 11 May, 2018 1 commit
    • Leon Arnott's avatar
      Added (click-goto:), (mouseover-goto:) and (mouseout-goto:), as shorthands for... · 78e86df0b493
      Leon Arnott authored
      Added (click-goto:), (mouseover-goto:) and (mouseout-goto:), as shorthands for the (click:), (mouseover:) and (mouseout:) macros combined with (goto:).
      
      The primary incentive for doing this was to add a special form of the link syntax, with no link text, resembling [[->passage name]], as syntactic sugar for (click-goto: ?Page, "passage name") etc., so as to promote the use of full-page clicking in stories, as an alternative, in strictly linear stories, to single links of arbitrary words. But, the appeal of this shorthand, as an alternative way to create otherwise normal links, is also desirable.
      78e86df0b493
  29. 10 May, 2018 1 commit
    • Leon Arnott's avatar
      Implemented (link-reveal-goto:), which functions as a combination of (link-reveal:) and (goto:). · 4813e279b3a8
      Leon Arnott authored
      I'd previously been unwilling to implement the old Twine 1 [[Link|Passage][x = 1]] link syntax for a few reasons, most notably that using = for assignment, while technically supported in Harlowe, is nonetheless heavily frowned upon, and there's no comfortably way to incorporate "to" or "into" in it without "set" or "put". Additionally, I felt adding another feature to the link syntax which didn't naturally arise from other syntactic structures was adding unpleasant complexity. I'd toyed with adding this as the macro (link-set-goto:), but I was uncomfortably with the syntax of a lone VariableToValue "$a to 2" in the middle of unrelated params, and additionally disliked how this looked like an "emergent concatenation" of (link:), (set:) and (goto:) by themselves, comparable to (mouseover-replace:) and its ilk, and had no model for explaining how this would make sense.
      
      What changed? I decided that it does make sense for (link-reveal:) to be concatenated with (goto:) to make (link-reveal-goto:), because the (set:) could be included in the attached hook, rather than crudely incorporated into the call itself. Moreover, by using a hook, any other arbitrary instant-effect macro could be used with it, like (alert:), or a hypothetical audio macro. Since this is only the concatenation of two macros - (link-reveal:) and (goto:) - rather than three, it's in keeping with (mouseover-replace:)'s example.
      
      I intend to add link syntax sugar for this, but am currently debating its exact form. Certainly it won't just resemble the Twine 1 form.
      4813e279b3a8
  30. 09 May, 2018 1 commit
    • Leon Arnott's avatar
      Implemented the (event:) macro, an alternative to (live:), along with the "when" lambda clause. · 4a431f886235
      Leon Arnott authored
      (event:), unlike (live:), live-renders the hook only once, and only when the given lambda, which is run every 20ms, produces true. The new lambda clause, "when", is just a version of "where" typed to only be accepted by (event:). Moreover, it can't take any temp variables or refer to "it" - it must refer to globals or local temp variables outside of it. This contradicts the definition of a "lambda", but I needed a way to express deferred computation to make this macro work, and this seems smoothest from the coder's perspective.
      
      Also fixed a bug where debug view would write messages referring to global variables as if they were in a temp variable store.
      4a431f886235
  31. 16 Apr, 2018 1 commit
    • Leon Arnott's avatar
      Implemented basic functionality for the "matches" operator. · 53288f790075
      Leon Arnott authored
      This supports basic structural matching, using datatype names as the 'blanks'.
      
      Also:
      
       * Renamed typenames (the user-facing Harlowe construct) to datatypes, to avoid confusion with internals' use of "typename".
      
       * Removed some typenames whose utility seems low (lambda, hookset, typename, data) at present.
      
       * Added "or a" as an invalid operator, to preclude people writing "$a is a number or a string".
      53288f790075
  32. 15 Apr, 2018 1 commit
  33. 14 Apr, 2018 1 commit
  34. 13 Apr, 2018 1 commit
  35. 11 Apr, 2018 1 commit
    • Leon Arnott's avatar
      Added a string-specific shorthand of (repeated:) called (str-repeated:). · 412b30269ce6
      Leon Arnott authored
      This will be followed by a number of other str- macros in the coming days.
      
      Additionally, the (text:) macro now has another alias, (str:). This alias will now be the preferred name for this macro in the documentation, mainly due to the arrival of other string macros that begin with "str-", and additionally to avoid semantic conflict with the various "text-" changer macros like (text-style:).
      412b30269ce6
  36. 10 Apr, 2018 1 commit
  37. 25 Feb, 2018 1 commit
  38. 15 Jan, 2018 1 commit