Giter Site home page Giter Site logo

samualtnorman / hackmud-environment Goto Github PK

View Code? Open in Web Editor NEW
36.0 3.0 4.0 476 KB

Scripting environment for hackmud with minification, autocompletes / intellisense, and TypeScript support.

License: MIT License

TypeScript 55.83% JavaScript 44.17%
hackmud trust-scripts hackmud-environment typescript typescript-files javascript type-definitions minify autocomplete intellisense

hackmud-environment's Introduction

Hackmud Scripting Environment

This is the whole kitchen sink built around HSM, setting this up takes more effort but will give you autocompletes in your IDE, automatic script pushing when you save a script, as well as minification. If you only need minification, I instead recommend heading over to Hackmud Script Manager.

ko-fi

You can read about how HSM works in my blog post.

Features

Minification

This is the main feature of this project and works with JavaScript or TypeScript. All scripts are automatically minified before being written into the hackmud folder. This means you can focus less on getting your character count down, and more on writing readable scripts.

Autocompletes/Intellisense

In modern editors like Visual Studio Code, as you're typing the names of subscripts or filling the args of subscripts, drop-down menus of relevant autocompletes will appear. Hovering over a script also tells you info like its security level.

TypeScript Support

Using TypeScript in this environment is completely optional, but using it means warnings when you use the wrong type in a subscript's args or use an unsupported type in a DB query.

First Time Setup

  1. Install Node.JS and PNPM
  2. If you have Git installed:
    • Make a new folder, cd to it, and run pnpm dlx tiged samualtnorman/hackmud-environment
    • Otherwise, click here to download the ZIP and extract it somewhere, then cd to it
  3. Run pnpm install

Important

Do not put this template in your hackmud folder. This will not work.
Instead put this template somewhere you have easy access to like your desktop or home folder.

Note

If you get an error message that looks like this:

[...]\AppData\Local\pnpm\hsm.ps1 cannot be loaded because running scripts is disabled on this system. [...]

You will need to run Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser in PowerShell as an administrator. For more information, see Microsoft's page about Execution Policies.

Guide

Writing scripts

You can create scripts in the src directory directly, and you can create a folder with the name of one of your users, and create scripts in that folder too.

Pushing Your Scripts

Use pnpm push to push all your scripts to all your users. To automatically push scripts as you edit them, leave pnpm dev running.

Scripts directly in the src folder are pushed to all your users. To have a script be pushed to only a specific user, create a folder in the src folder and create your scripts in that new folder.

Once a script has been pushed to a user, you can run #up <script> in game to upload it.

Useful links

Optional Features

This is only for if you're using TypeScript.

Alternative Preprocessor Format

To take advantage of the type definitions written for subscripts and preprocessor functions, you'll need to replace the # characters with $ characters. For example instead of writing #fs.scripts.trust(), you'll need to write $fs.scripts.trust(). A big change, I know.

Inter-script Type Checking

To gain type checking for the other scripts you've written in the environment, instead of starting your scripts with function (..., start them with export default function(....

Note

When using this format, to get autocompletes working in hackmud, you must have a // @autocomplete foo: "bar" comment at the top above all other code.

Contributing

Contributing is appreciated, especially if you have an API to add to the type definitions.

Credit

This project was originally a fork of Snazzah's hackmud_env.

Related Projects

Hackmud Color

If you want to see your strings coloured to how they'd appear in the game, check out Hackmud Color, my VS Code extension.

Hackmud Script Manager

This is the script manager that this environment relies on. Visit the NPM page, or the repo.

hackmud-environment's People

Contributors

danswann avatar dependabot[bot] avatar samualtnorman avatar snazzah avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

hackmud-environment's Issues

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.