Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

UserUNP/sparkscript

Repository files navigation

DEPRECATED

I'm no longer maintaining this.

DiamondFire library

Simple to use DiamondFire library for Javascript.

Check out DiamondFire, its pretty cool.
Manual template manipulation guide by Owen here

gh-actions gh-actions
npm-sparkscript
Warning: No stable version yet.. everything might flop and/or change

Example: for current git build

// import the quick editor
// import df from "sparkscript";
const df = require("sparkscript").default;

const template = df("Test template", (e, s) => {
  // e short for "editor"
  // s short for "settings"
  e.defAction("giveItems", (/* args */) => {
    e.player.action("SetHotbar", e.mc("cod", "§b§l<-§c§o killer fish §b§l->"), e.mc("bow", "§b§l<-§c§o le bow §b§l->"))
    //* you can use & for other things. use § for color codes.
  });

  //* you can use .setTarget() to specify the player to target. you can also chain it amongst other functions
  //* ex:
  // const funnyAction = e.player.action("DoAFlip").setTarget("Default")
  // funnyAction.setInverted(true).setAction("NOTAFlip)

  e.player.event("Join");
  e.action.giveItems();

  e.player.event("Respawn");
  e.action.giveItems();

});

const code = template.export();
console.log(code.compressed);

Key features:
> Read from template data with .from( ) function.
> Read & compile from Spark file, buffer or string. till spkc v2 gets an official release.
> Easy to use template editor.

Actiondump

You might need to specify the actiondump using the setActionDump function that's in default export.
Or use the codeDump file that exports all actiondump related functions into a default object, simply import the file:
const codeDump = require("sparkscript/core/codeDump"); or import codeDump from "sparkscript/core/codeDump";

Build from source

You can use either npm or yarn for this.

mkdir sparkscript
cd sparkscript
git clone https://github.com/UserUNP/sparkscript .
npm install
npm run build