1.1.9 • Published 2 years ago

aw-action-parser v1.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

aw-action-parser

This library parses ActiveWorlds object action strings (also known as object scripting) into a machine-friendly data model.

Installation

npm install aw-action-parser

Usage

    import { AWActionParser } from 'aw-action-parser';

    const parser = new AWActionParser();

    parser.parse('create color blue, sign "hello!"; activate color salmon, rotate -.5 loop nosync');

The parse() function will then return an object looking like this:

    {
      create: [ { commandType: 'color', color: { r: 0, g: 0, b: 255 } } ],
      activate: [
        { commandType: 'color', color: { r: 111, g: 66, b: 66 } },
        {
          commandType: 'rotate',
          speed: { x: 0, y: -0.5, z: 0 },
          loop: true,
          sync: false
        }
      ]
    }

Features

  • Color parsing into RGB values (0-255)
  • Duplicate actions and commands squash (e.g. multiple create actions or multiple color commands)

Missing features

  • Impossible actions on AW (e.g. create teleport ...) are not currently filtered out
  • Some commands like media support only a few parameters
  • teleport / warp
    • Better output format for coordinates, altitudes and direction

Testing

Unit tests are essential for this kind of project and you can run them with:

npm test
1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago