|
Post by Ice on May 21, 2020 14:52:32 GMT
l: final_score t: textline q: indicate number -
l: final_check t: jump - if $final_score <= 1 then goto needs_improvement - if $final_score >= 2.34 then goto meets_expectations - if $final_score >= 3.67 then goto outstanding
l: needs_improvement t: info q: <h1>Interpretation</h1><b>NEEDS IMPROVEMENT</b>
j: end
l: meets_expectations t: info q: <h1>Interpretation</h1><b>MEETS EXPECTATIONS</b>
j: end
l: outstanding t: info q: <h1>Interpretation</h1><b>OUTSTANDING</b>
No matter how much I change the conditions in the 'final_check', I can't seem to get the desired results where I want any inputed number from 0 - 2.33 would jump to 'needs_improvement', numbers from 2.34 - 3.66 would jump to 'meets_expectations', and 3.67 - 5.0 would jump to 'outstanding'.
I can't seem to do it. I understand the logic but the code doesn't work. I did a lot of combinations inside 'final_check' but I'm stumped and this is the last attempt I did before going here.
|
|
|
Post by PsyToolkit on May 21, 2020 19:28:11 GMT
I just checked this myself and it works fine. PsyToolkit will take the first line that matches. That means that if you enter a number greater than 2.34 it will always go to meets_expectations
|
|
|
Post by Ice on May 22, 2020 1:48:54 GMT
Re-run the code, doesn’t work. When I input 2.34 it still jumps to needs improvement instead of meets expectation. And it only jumps to meets expectations only when inputing 3.0 and above but it never jumps to outstanding.
|
|
|
Post by PsyToolkit on May 22, 2020 7:03:32 GMT
I just checked. The current version rounds the value to integers (that is, whole numbers without a ".") I can change this, for historical reasons integers were used only. For the time being, you can "multiply your value by 1000" first like below and then it works. Also make sure your if line works better. The example below does exactly what you want, look in particular ar the red lines.
l: final_score t: textline q: indicate number - number:
l: final_score_multiplied t: set - calc $final_score * 1000
l: some_feedback t: info q: The number you types is <b>{$final_score}</b>, the multiplied one is <b>{$final_score_multiplied}</b>
l: final_check t: jump - if $final_score_multiplied <= 1000 then goto needs_improvement - if $final_score_multiplied >= 2340 && $final_score_multiplied < 3670 then goto meets_expectations - if $final_score_multiplied >= 3670 then goto outstanding
l: needs_improvement t: info q: <h1>Interpretation</h1><b>NEEDS IMPROVEMENT <= 1</b>
j: end
l: meets_expectations t: info q: <h1>Interpretation</h1><b>MEETS EXPECTATIONS => 2.34</b>
j: end l: outstanding t: info q: <h1>Interpretation</h1><b>OUTSTANDING >= 3.67 </b>
|
|
|
Post by Ice on May 26, 2020 15:20:08 GMT
The code works but I now have an issue with 'j: end'. When I compile using the aforementioned command, I get this: Compiler errors (note: survey will not work with errors):
"goto"-statement without existing label in line "goto end", check spelling of "end"
|
|
|
Post by Ice on May 26, 2020 15:36:34 GMT
Sorry, I used version 2.6.0 and when I changed to 3.0.0 it has no more issues.
|
|