Git Product home page Git Product logo

harlowe-macro-api's People

Contributors

chapelr avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

harlowe-macro-api's Issues

README cleanup

  • Changers could use more examples and clean up.
  • Warn about (or fix) basic macros taking over hooks.
  • Wording and typos.

Steamworks API Macro

Do you think it would be possible to create a Steamworks API Macro using this?

Basic macros and hooks.

It seems like basic macros that return stuff are launching themselves at hooks. Will investigate.

Macro submission: macro passages

A gist with the source and documentation can be found here.

(If the documentation needs to be reworked to fit the rest of the site I can assist, but this is a pretty complicated macro to document.)

I found myself with a bunch of little complex calculations I needed to run regularly throughout my game, and I was able to halfway fake macros by making code-only passages that would read and write global variables to accept arguments and return results, and I could then (display:) the passage to run it.

That ended up being a hot mess, because the arguments and results would stick around forever as global variables, and the syntax was clumsy and verbose. Also, I had to use some complicated self-replacing hooks to make sure to not accidentally mess up the spacing and formatting on the calling passage.


I used this framework to hack into Harlowe ever so slightly to create real macro passages. This adds a (macro:) macro that accepts a suitable passage name (one that's been tagged with macro) and any arguments. The macro passage will immediately run off-screen, with the arguments array available in _args and the ability to return a value in _result. Everything is nicely isolated, and shouldn't interfere with the calling passage's formatting or variables.

For some additional sugar, tagging a passage with both macro and auto-macro will turn the entire passage into a first-class macro on startup, so you can just use (macro-name: <...arguments>) instead of (macro: "macro name", <...arguments>).

More detailed info and caveats are available in the gist itself.

More examples.

More examples and maybe an example project.

I can look at Custom Macros for SC 2 for ideas of macros to port over.

Basic ideas that might be neat:

  • Meter macros (simplified version) (tough)
  • Articles macro set. (moderate)
  • First macro. (easy)
  • Speech box system. (moderate)
  • Playtime system. (easy)

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.