Overview of HSAPI
.hopscotch project files. It is currently under active development.website·Indexed 30 days ago
https://hsapi.devA low-level transpiler for parsing and writing .hopscotch project files. HSAPI provides tools for Hopscotch hacking projects, including specifications for project JSON structures, blocks, abilities, and the Hopscript language.
.hopscotch project files. It is currently under active development.Hopscotch projects are stored as JSON files (with the .hopscotch extension on mobile apps). The data is organized in a hierarchical container system:
datum property of parameters. They share a set of common properties that define their behavior and classification.Hopscript is designed to provide a textual representation of Hopscotch code. Its primary objectives are to represent any Hopscotch code textually, remain intuitive for users familiar with Hopscotch, and provide a simple bidirectional interface with existing Hopscotch code.
Secondary goals include:
and vs. a block named and).The datum property determines the data contents of a parameter, allowing it to be more than a static value. When a datum is present, it typically overrides the value property. The player resolves datum objects in this priority order:
A datum can contain:
Two root properties control how the project is opened and edited:
requires_beta_editor (boolean): If true, the project was saved with the advanced editor and requires a Hopscotch subscription to edit.version (number): The latest Hopscotch app version used to save the project. Projects will not open in app versions older than this value. If version <= 24, the app uses the old player instead of the web player."requires_beta_editor": true,
"version": 34hsapi calls to modify the output of the hopscotchification process. Extensions must be explicitly opted-into by the files they affect.# Example of defining a Scope as an object type in an extension
Scope Game:
When i_am_used:
# Use the `Rule` scope to refer to arguments
hsapi_create_variable(named: Rule.variable_name, type: HSBlockType.Game, store_into: result)
return(result)
# Example of an enum extension
enum HSBlockType:
...
Game = 8003
...Custom blocks and rules are defined using the syntax <type> <name> [parameters]:.
Custom_block <name> [parameters] or Custom_rule <name> [parameters].# Definition
Custom_block do_something(argument: "Default value", arg2: 0):
# block logic here
# Reference (used inside another block)
Custom_rule make_a_grid(width: 5, height: 5)_setRequiresBetaEditor to set the requires_beta_editor value in the project JSON. This is required for advanced mode files to accurately recreate app behavior._setRequiresBetaEditor <boolean>