It looks like you're new here. If you want to get involved, click one of these buttons!
state.display("foo", this);
I think this doesn't work because I am using SugarCube. I am having difficulty finding any help in the SugarCube documentation for what the changes to this syntax are that will make this work to go to "foo."
Comments
I assume you're trying to use that code snippet in the middle of a rendering passage? If so, that won't work (in any header).
What, specifically, are you attempting to do?
There must be a javascript function to send you to another passage, because the whole thing operates on javascript. I just can't figure out what the exact syntax is, and no errors come up in the console due to the way Twine abstracts passage-level js...
There's a lot of stuff going on, and I've already embedded a bunch of my story in the file, so I'd rather not share the entire source code.
In the following example, vars['foo'] is just my shorthand for state.active.display('foo'). There are links that the user can click in the passage that, instead of taking them to another passage, run like a "cyclingLink" (it's a custom variant of that macro, but very similar) and set variables in doing so. The cycling links set variables called pageVar1 and pageVar2... again, this happens during an existing, active passage, so wiki syntax won't capture any changes made here.
Depending on what values the user ended the cycling links on, the link to the next passage should go to a different place.
I could do this by having my cycling links also hide and reveal different links with CSS (because I am using a custom macro to do cycling links that can also initiate js scripts on click), but this is tedious and messy. So, I'm doing this instead: In any case, the problem I had before was a syntax error on my end... I'd be embarrassed, but how can I see what errors there are? Some syntax errors print out that warning at passage render, but others don't... and when they don't, they also don't trigger a warning when invoked either, just nothing happens at all. This makes finding bugs like that very difficult. Anyway, it works now.
As to how to see errors in code that's outside passage rendering, normally you'd simply check the console log (virtually all major browsers include developer tools now). If it's some kind of runtime error, rather than simply buggy but legal code, you should see an error in the log.
That won't work here though, since <<click>> discards errors. I should be able to make it propagate errors to the console log. I'll put that on my TODO list.
Wow! Thanks! I had no idea this would prompt a change to the build. I thought it not propagating those errors was set in stone. Now I CAN see the error in the console easily.
One thing though, does there need to be an alert message for the error? Sometimes there can be errors which don't actually break the game where it would be better to just let the game continue even though there was an error. I know, promoting dirty code isn't the most popular thing to do, but as long as the error is in the console log as it is now, the alert pop up could just get in the way of smooth play in some cases where the error doesn't matter, and won't help a serious developer find the error in the log anyway.