It looks like you're new here. If you want to get involved, click one of these buttons!
/*pop-up*/ Macro.add("popup", { version : { major: 1, minor: 0, revision: 0 }, handler : function () { if (this.args.length < 2) { var errors = []; if (this.args.length < 1) { errors.push("link text"); } if (this.args.length < 2) { errors.push("passage name"); } return this.error("no " + errors.join(" or ") + " specified"); } var el = document.createElement("a"), passage = this.args[1], title; el.innerHTML = this.args[0]; el.className = "link-internal macro-popup"; el.setAttribute("data-passage", passage); title = el.textContent; UI.addClickHandler(el, null, function (evt) { var dialog = UI.setup(title, "popup"); new Wikifier(dialog, tale.get(passage).processText().trim()); }); this.output.appendChild(el); } });
Click to view <<popup "Map" "Map complex">>
<<set $n to 0>> <<set $Inventory = ["Revolver", "Letter", "Money", "Water"]>> [[passage 2]]
<<set $Inventory.push("Hat", "Coat")>> <<set $items to $Inventory[$n]>>\ <<popup "view items" "$items">> [[$items]]
Comments
From the SugarCube 2.x Macro Library documentation: