Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Translating Python in-line script to Javascript?

Hello,

I'm using a Python code that is necessary for my experiment, which codes for getting multiple keyboard responses within a specific duration of 500 ms or 1300 ms. This code has made it possible to press two keyboard responses and will wait the entire duration of either 500 ms or 1300 ms before advancing to the next screen. Without this code, my experiment does not work properly (I will attach an image below).

However, I need to launch the experiment online and the in-line script is not compatible with OSWeb. Because of how little I know about coding, I was wondering if anybody could help me with figuring out a Javascript version of this code?

Unfortunately, I read that Javascript only accepts codes about variables and not keyboard responses. if it is not possible to translate this code because of this, is there another way for me to get this experiment online that does not require OSWeb, but will still allow me to log data and compensate the participant with payment?

Thank you so much!

Best,

Nikita


Comments

  • Hi Nikita,

    Yes you are right, your first line has no javascript equivalent currently. A way to bypass this issue is to use two regular keyboard response items. The first one running for 500 ms, the second for 500-the response time of the first keyboard response item. Like that, I think a similar funcationality as what you have coded could be achieved. Is that possible? If so, this would even make it easier to move the experiment online, as you need to do less javascript (computing the response time, and set the duration of the 2nd keyboard with that time).

    Hope this helped,

    Eduard

    Buy Me A Coffee

  • And like Sebastiaan, already told you, please don't post the same question multiple times. I haven't seen that he already replied to you (and his suggestion probably making more sense).

    Thanks

    Buy Me A Coffee

  • Hello Eduard,

    Thank you for that response. Yes, I will refrain from posting the same questions in the future. I apologize about that!

    Best,

    Nikita

Sign In or Register to comment.