Howdy, Stranger!

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

Supported by

consent OSWeb

edited June 2020 in OpenSesame

Hi,

I need to add a consent form with a checkbox in the beginning of the experiment; and I was wondering if there is any solution to adapt it to the OSWeb for a JATOS study since I just discovered that form items are not compatible.

Best,

Hülya

Comments

  • Hi Hulya,

    Here is some Python code to have an informed consent. Of course you would have to translate it to Javascript, which will be a challenge (if not impossible) as the mouse item cannot be used in javascript inline. But maybe you can use the code to wrap a loop with Opensesame items and the mouse item to mimic the same effect.


    Here the code:

    import os
    
    def drawX(cv,x,y,color):
    	cv.line(x-14 ,y-14 , x+14 , y+14, color=color)
    	cv.line(x-14 ,y+14 , x+14 , y-14, color=color)
    	
    # create objects
    my_cv = canvas()
    my_mouse = mouse()
    my_cv.set_fgcolor('red')
    my_cv.set_penwidth(10)
    
    # image dimensions 
    Iwidth = 1535  
    Iheight = 1151 
    
    #scale image onto screen
    im_scale = min(float(var.width)/Iwidth,1) 
    new_dimX = Iwidth * im_scale
    new_dimY = Iheight * im_scale
    
    # relevant positions of important addons
    rel_Xcheck = 0.24
    rel_Ycheck = 0.78
    rel_Xtext =  0.14
    rel_Ytext = 0.02
    
    # The location of the checkbox
    x_check = -(0.5 * new_dimX - new_dimX * rel_Xcheck)
    y_check = -1 *( 0.5 * new_dimY - new_dimY * rel_Ycheck)
    # The location of the 'participant X' text
    x_text = - (0.5 * new_dimX - rel_Xtext * new_dimX)
    y_text =  - (0.5 * new_dimY - new_dimY * rel_Ytext)
    
    # load image 
    path = pool[u'InformedConsent_EN.png']
    
    #print os.getcwd()
    # show canvas
    save = False
    while True:
    	button, position, timestamp = my_mouse.get_click(timeout=20)
    
    	#draw canvas with image
    	my_cv.image(path,scale = im_scale)
    	# draw participant no on top
    	my_cv.text('subject'+ str(var.subject_nr), x = x_text, y= y_text)
    	pos, foo = my_mouse.get_pos()
    	if x_check - 10 < pos[0] < x_check + 10 and y_check - 10 < pos[1] < y_check + 10:
    		drawX(my_cv,pos[0],pos[1],"green")
    	else:
    		drawX(my_cv,pos[0],pos[1],"red")
    	my_cv.show()
    
    	if button:
    		if x_check - 10 < position[0] < x_check + 10 and y_check - 10 < position[1] < y_check + 10:
    			save = True
    			drawX(my_cv,position[0],position[1],"green")
    			clock.sleep(500)
    			break
    	my_cv.clear()
    if save:
    	
    	baseDir = os.path.join(os.getcwd(),"../experiments/predictiveSwitchingIntention/InformedConsent")
    	path = os.path.join(baseDir,'subject_no_'+str(var.subject_nr)+'.png')
    	self.experiment.window.getMovieFrame()
    	self.experiment.window.movieFrames[0].save(path)
    



    Buy Me A Coffee

  • Hi Eduard!

    Thank you very much for your response, and apologizes for my late answer.

    I also would like to ask for a similar form problem: I need o get multiple keyboard inputs as responses in one sketchpad. Is it possible? I am using the solutions that were recommended before https://forum.cogsci.nl/discussion/6274/is-a-way-to-record-id-of-participants in here, but I couldn't seem to adjust it to my needs. Basically the form is something like this:

    __ % of time I ...

    __ % of time I... and so on. Participants need to enter 10 numbers like this in one form. But when I try the upper solution, the second response always takes the first one - I fixed this by logging different variables for the second (like var.percent1, var.percent2 ... etc = ' ' in the init phase) but then the second one does not take any input at all, and looks like I need to have 10 seperate blocks and sequences and inline scripts for every single answer. Is there a more elegant way to solve this? Here is a screenshot of how I am being ridiculous.


    Best,

    Hülya

  • Hi Hülya,

    I assume you need this for OsWeb (even though you put it on the Opensesame forum). If you actually need it for offline Opensesame, there is no need to use javascript.


    I don't think I understand your issue or your approach. Would you mind explaining again. Or if your problem is the same as you described here, let's try to keep the discussion central and not spread over multiple threads. That only makes things more confusing and messy. So, if these two problems are the same, let's talk in the other discussion.

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.