I am trying to run the following code in Twine 2.51 but when I test it the “Submit” button is not working, I click it and nothing happens:
@@.delayed;Great! To make sure our work is consistent, I constructed the true confidence intervals of the preparation, rework, and packaging stations.@@ @@.delayed;Based on the results of your hypothesis tests, which type of error (Type I Error or Type II Error) should be calculated at each station?@@
[img[images/DataAnalyst.jpg]]
Preparation Station:
<<listbox “$response1”>>
<<option “Type I Error (α)”>>
<<option “Type II Error (β)”>>
<>
Rework Station:
<<listbox “$response2”>>
<<option “Type I Error (α)”>>
<<option “Type II Error (β)”>>
<>
Packaging Station:
<<listbox “$response3”>>
<<option “Type I Error (α)”>>
<<option “Type II Error (β)”>>
<>
<<button “Submit”>>
<<if $response1 is “Type I Error (α)” and $response2 is “Type I Error (α)” and $response3 is “Type II Error (β)”>>
<<set $scores = $scores + 3>>
[[CORRECT|Chapter53.2]]
<>
[[INCORRECT|Chapter53.1]]
<>
<>
Hi! Could you wrap your code in the code block (three → ` ← around the code) so we can see all your code?
Thank you!
EDIT: @marcusjames0930 If I were to guess, this might be because of the code inside the button. What you might want to do instead is something like this:
<span id="result"><<button “Submit”>>
<<if $response1 is “Type I Error (α)” and $response2 is “Type I Error (α)” and $response3 is “Type II Error (β)”>>
<<set $scores = $scores + 3>>
<<replace "#result" t8n>>[[CORRECT|Chapter53.2]]<</replace>>
<<else>>
<<replace "#result" t8n>>[[INCORRECT|Chapter53.1]]<</replace>>
<</if>>
<</button>></span>
A button (or link) can only compute code within the macro, but not show text/other indicators on the page unless you use tell it to do so, with the <<append>>
, <<prepend>>
or <<replace>>
macro.
Documentation: SugarCube v2 Documentation
2 Likes