Howdy, Stranger!

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

Link to a new passage in Javascript [Sugarcube]

I'm fairly new to Twine so I'm not sure how this is supposed to work exactly. I've got a dungeon crawler that shows a map and I want to make it so you can move with the WASD keys instead of press to go to the directions. I've got a passage for each direction, but how do I make it so that the WASD keys go to their respective passages and only on the page where relevant?
<<display "Location">> \\Shows the map to the player.

<<script>>
$(document).on("keyup", function(dir) {
	if (dir.which = 68) {
		//This is where you'd go to passage called "East"
	}
});
<</script>>

Now I don't even know if I'm supposed to put the script somewhere else, I looked up the documentation on script in sugarcube and it didn't give much info.

Comments

Sign In or Register to comment.