In an attempt to create a method that would prevent the infamous << return >> macro loop, to avoid soft locking myself when trying to access my inventory and the other passages it needs in order for my stuff to work, i went to google, and long story short I pasted this JavaScript into the story stylesheet!
predisplay["Menu Return"] = function (Menu Check) {
if (! tags().contains('noreturn')){State.variables.return = passage();
}
};
What I’m trying to do is make the script save what passage I’m on into a $ variable that i can put into a passage link! However, I don’t want it save any passaged that are marked with a tag named “noreturn”!
The problem is that it doesn’t work! the words “if”,“.contains”, and “State.variables.return” are all highlighted in dark red and I’ve never used JavaScript before! The debug menu when i play doesn’t show any $ variable for return, and it just sends me to a passage literally named “$return” instead of anything else!
I’ve also tried
predisplay["Menu Return"] = function (Menu Check) {
if (! tags().includes('noreturn')){State.variables.return = passage();
}
};
Same results there
I’m using twine 2.10.0, sugarcube 2.37.0