Howdy, Stranger!

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

Keyboard commands in Sugarcube

Hey, so I'm currently using Sugarcube 1.0.35 on Twine 2. I was wondering if there's any possible way to switch to a certain passage if you hit CTRL+ALT+T on the keyboard (at any time). I know this is really weird and specific but help would be very much appreciated!

Comments

  • edited April 2017
    Put this in your JavaScript:
    (function () {
    	$(document).keyup(function (e) {
    		if (e.keyCode === 84 && e.altKey && e.ctrlKey) {
    			state.display("passage you want to go to");
    		}
    	});
    }());
    

    You should be careful with stuff like this, since Ctrl-T usually opens a new tab, and many browsers use shortcuts like this. Yours should take precedence, but still. Awkward things can happen.
  • Thank you, you're amazing!
    I'll be careful, lol :D
Sign In or Register to comment.