I am using this auto popup macro:
/* Usage: <<autopopup "Some Pasage">> */
macros.add("autopopup", {
version : { major : 1, minor : 0, revision : 0 },
handler : function () {
if (this.args.length === 0) {
return this.error("no passage name specified");
}
var dialog = UISystem.setup("popup");
new Wikifier(dialog, tale.get(this.args[0]).processText().trim());
UISystem.open();
}
});
But in twine 2.2.1 and sugarcube 2.21.0 it returns this error:
Apologies! An error has occurred. You may be able to continue, but some parts may not work properly.
Error [tw-user-script-0]: macros.add is not a function.
What should I change?
Edit:
Looked at the twine 2 popup macro and changed a few things. Here is the new code:
/* Usage: <<autopopup "Some Pasage">> */
Macro.add("autopopup", {
version : { major : 1, minor : 0, revision : 0 },
handler : function () {
if (this.args.length === 0) {
return this.error("no passage name specified");
}
var dialog = UI.setup(title, "popup");
new Wikifier(dialog, tale.get(passage).processText().trim());
UISystem.open();
}
});
And here is the new error:
Apologies! An error has occurred. You may be able to continue, but some parts may not work properly.
Error: cannot execute macro <<autopopup>>: Story.get title parameter cannot be a function.
Stack Trace:
Wikifier</t</<.value@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:166:11134
.handler/<@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:167:26969
MacroContext</e</<.value/</<@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:167:12322
MacroContext</e</<.value/<@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:167:12136
t/<@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:164:24536
r.event.dispatch@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:60:10263
r.event.add/q.handle@file:///home/pi/twine_2.2.1/index.html#!/stories/faf09f4c-c592-4d02-a722-67964bf7ec3e/play:60:8325
At least the story starts now though.