Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
Tutorial explaining how to get started writing custom classes in AdventureJS. tutorial, classes

Advanced Scripting:Custom Classes

To be written...

// createClass()
// Later in this file, we'll create several whiteboard markers.
// We already have a class, Marker, but we want a specific
// WhiteboardMarker class that will be the only class of
// Assets that are allowed to write on a Whiteboard.
//
// This is the bare minimum needed for a class definition.
// The only thing that sets it apart from Marker is the class
// name, but that's how instances of the class will be
// identified by verb methods trying to determine whether
// the classes can be used together.
//
// Creating custom classes is an advanced move, so if you decide
// to create some, be sure to RTFM and test them extensively.
// See https://adventurejs.com/doc/AdvancedScripting_CustomClasses.html
// for more info.
// WritingDemo.createClass(
//   class WhiteboardMarker extends adventurejs.Marker {
//     constructor(name, game_name) {
//       super(name, game_name);
//       this.class = "WhiteboardMarker";
//     }
//   }
// );

// Remember where we set up our custom WhiteboardMarker class?
// setting whiteboard.dov.write.with_classes = ["WhiteboardMarker"]
// establishes that only WhiteboardMarkers can write on Whiteboard.