New to Twine, started with Twine 2 and SugarCube 2.
I want to experiment with custom macros, but every time I try to play my Story with any macros I get an error. The alert dialog is partially cut off, but I think it reads: "Error [tw-user-script-0]: undefined is not a function". The macro in question is:
macros.add("mytest", {
handler: function () {
try {
console.log("This is a test.");
}
catch (e) {
return this.error("Yay, you broke it! " + e.message);
}
}
});
I have finally found reference to that error in regards to using SugarCube 1 code with SugarCube 2, so presumably the examples I was working with aren't valid for SugarCube 2. Sigh!
Comments
Without testing I think your original example would look like: