Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Hoverlink menu?

I'm trying to find a way so that whenever the player hovers over a hyperlink a menu pops up above it with a verb/action list. e.g. if they mouse over an object like 'television' a menu comes up suggesting 'watch' or 'turn off' or other similar verbs.

I can't find any macro that is at all like this. And my ability to write code is worse than appalling. Can anyone help?

Much appreciated,

(Running twine 1.4.2 with sugarcube)


  • There are lots of ways to do this, of course, but this is probably one of the easiest:

    It requires that you know something about importing third-party jQuery plugins and applying various settings, though.
  • I have one (already coded) for SugarCube.... Is that what you are using?

    Nm. I see that you are.

    This one works for 2.0, but you're welcome to try it.
  • edited May 2015
    Come to think of it, I am CERTAIN TheMadExile wrote it.

    This part is in the passage where you first introduce it
    You see <<popup "a door" "Doorway">>... or maybe you [[walk to the window]]

    Then this goes in the Doorway passage you create
    Do you
    [[Kick the door open|KickDoor]]
    [[Slowly open the door|OpenDoor]]
    [[Inspect the door|InspectDoor][passHours(2)]]
    And then in your javascript you put this
    macros.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");
    		el.innerHTML = this.args[0];
    		el.className = "link-internal link-popup";
    		el.setAttribute("data-passage", this.args[1]);
    		UISystem.addClickHandler(el, null, function(evt) {
    			var dialog = document.getElementById("ui-body");
    				.addClass("dialog popup");
    			new Wikifier(dialog, tale.get("data-passage")).processText().trim());
    			return true;

    Ignore the pass 2 hours... I was testing Claretta's thing.
    Doorway (as a passage) will look disconnected. Don't worry about it. It's normal.

    Hope that helps.
  • That's quite close to what I'm looking for -- thanks!
  • Cool, @Snoother
    Glad I could help.

    Can you please click "Answered" on this?
Sign In or Register to comment.