I am trying to create a rating scale from 0-10 and when participants hover over the numbers, the border around the number would change colour. I have done this by layering two images (normal and highlighted borders) on top of each other and changing the opacity using the .contains function
Hi @Tatsumi, yes you need to translate the code in your code component from Python to JavaScript manually. In the future, this will be automated, but for now it is manual. To do this. change your code type in the code component to “Both”, so you see Python on the left and JS on the right. For the JS, you want:
Thank you @dvdbridges! It works now. However, previously, the rating scores would be recorded but now it doesn’t so I thought it is because it is not in jscode. I tried changing it myself by looking at other codes and came up with this
So this is what I have done, and to test if it works, I duplicated this current routine and made the appropriate changes to the codes in a new one like so
So in the two routines, the first number (first routine) I selected was 7 and the second number (second routine) I selected was 2. According to the output, my selection in the first routine was recorded but the ratingScore was not. And for the second routine, my selection and ratingScore was recorded but it shares the same row as my first routine.
The two routines are probably in the same loop?.. so they get saved on the same row in the conditions file. At the end of each loop iteration, all the variables get saved into a new row in the conditions file. You only have one rating, because your second rating has overwritten the first rating with the same column name. You should get two entries if you change “ratingScore” column name in the second routines code component.
Not sure what is happening here without seeing the task, but the error suggests that orangeOne is now a number (int) rather than an image. Perhaps orangeOne has been overwritten?