ScriptBase This is a base class that you can use to structure your script. Side Note: Most Roll20 scripts are wrapped in a function. This is a construct in JavaScript known as "IIFE" (Immediately Invoked Function Expression). This is an old concept used to create isolated "modules" of code. You can read more about IIFEs here . I am choosing to use JavaScript classes to isolate code instead. This is what enables the ScriptBase approach. The bare minimum script will look like this class _MyCoolScript extends ScriptBase ( { name: "MyCoolScript", version: "0.1.0", // This can be any string. I like to use semver versioning , but you can put whatever you want. }) { constructor() { super() // You MUST remember to call super() in the constructor! this. parser = new CommandParser('!cool-script') .default((options, message) => { sendChat(this.name, "I don't know what my favorite color is :(") }) } } // You must remember to instantiate your script at the bottom const MyCoolScript = new _MyCoolScript() If your script needs to keep track of state (data that persists, even between Roll20 sessions), ScriptBase will handle that for you! class _MyCoolScript extends ScriptBase ( { name: "MyCoolScript", version: "0.1.1", // Make sure that stateKey is unique for all of your scripts. If there are duplicates, you will have problems stateKey: "MY_COOL_SCRIPT", // Here you specify how the state should be at the start. It could be as simple as an empty object {} initialState: { favoriteColor: "blue" } }) { constructor() { super() // You MUST remember to call super() in the constructor! // If you need to add more event handlers , you can do that here as well: // on("ready", () => console.log("ready!")) // on("change:graphic", (obj) => console.log("Graphic changed!")) this.parser = new CommandParser('!cool-script') .default((options, message) => { // You can access the state via this.state sendChat(this.name, "My favorite color is " + this.state.favoriteColor) }) .command('set', this.setColor) .command('reset', this.resetColor) } setColor = (options, message) => { const newColor = options._[0]; if (!newColor) { throw new Error("Please specify a color!") } this.state.favoriteColor = newColor } resetColor = (options, message) => { // You can call this.resetState() to set the state back to its initial value this.resetState() } } const MyCoolScript = new _MyCoolScript()