Background:
I was stuck for 2-3 days in my twine game project and decided to get help from forums. I was trying to create a workaround and simplfied version of my code to demonstrate the problem. And I have found this weird bug where a comment with two backslash causes following crush fault:
Apologies! An error has occurred. You may be able to continue, but some parts may not work properly
Error [StoryInit]: <<run>>: bad evaluation: $Distinct is not defined.
Code goes to StoryInit passage
<<run (function() {
// problem workaround
$Stat = function(id, start) {
// default gain updater that's a normal stat expected to have
this.getUpdate = function(amount) {
return new $Updater(
[ new $Modifier(this.id, new $Fn(this.modify, new $Args(amount), this)) ]
);
};
};
$Distinct = function(updaters) {
var here = "is not important and this is simplfied code from my project"
// it's whether $Modifier or $Requirement that both has id property
return "if you remove the comment above everything works fine?!"
};
})();>>
This is simplfied and cropped from my project. If you simply create an empty twine with story format sugarcube 2.x add a StoryInit and replace the code above, then try to run project. You should get the error that I got. Simply remove the comment that's in $Distinct object. Everything works fine.
http://www.mediafire.com/file/5msmwwa0rs17an1/bug_workaround.html
here is the workaround that you can load into twine. let me know what do you think.