In my experiment, I want participant to receive cumulative accuracy feedback on their yes/no responses. When running online, the message doesn’t show percentage correct, it’s always Score = NaN% , but other part of the conditional feedback message shows up normally.
Hi @tokaalmighty, that is JavaScript telling you there is some kind of type mismatch calling String(number_correct * 100 / trials.nTotal). Can you confirm that both number_correct and trials.nTotal are numbers? If one of them is undefined the result of that operation would be NaN if that makes any sense. Why not check ahead of assigning to msg? You could say for example,
OK for some reason trials.thisN starts off at 15 and as such number_correct is never initialised to 0. It would be undefined in the first loop and ends up NaNas a result of adding 1. I have made a few tweaks in place to demonstrate a potential fix, but it would be relatively simple to transfer that into your custom code component within the PsychoPy Builder. Below is a preview. Hope that helps, s.