multiple conditions referring to different slides, type mismatch

24 views
Skip to first unread message

arm...@uchicago.edu

unread,
Apr 2, 2018, 8:49:50 PM4/2/18
to E-Prime
Hi All,

The responses to 2 different slides inform an If/then statement that sets an attribute in a task I am building. The attribute is the stimulus path for an image that participants will later see.

If a participant responds on GirlAvChoice, they will NOT respond on BoyAvChoice due to a jump - they will never see BoyAvChoice. 
GirlAvChoice is for girls only, and BoyAvChoice is for boys. 

The accepted responses for both AvChoice slides are the same: 1-9 (each number corresponds to an image the participant selects). 

If I include only one .RESP in the inline (GirlAvChoice.RESP or BoyAvChoice.RESP), the script works like a charm and assigns all 9 of the images correctly FOR THE ONE AvChoice THAT WAS INCLUDED, 

Code:
If GirlAvChoice.RESP  = 1 Then
c.SetAttrib "avatar", "Female5_MBrBl_Chicago.jpg"
ElseIf GirlAvChoice.RESP = 2 Then
c.SetAttrib "avatar", "Female6_Chicago.jpg"
Else c.SetAttrib "avatar", "X.jpg"
End If


however if I include both GirlAvChoice.RESP and BoyAvChoiceRESP in the same inline, I get the following error:

Type mismatch
Error Number:13

Code:
If (BoyAvChoice.RESP = "" And GirlAvChoice.RESP  = 1) Then
c.SetAttrib "avatar", "Female1.jpg"
ElseIf (GirlAvChoice.RESP = "" And BoyAvChoice.RESP = 1) Then
c.SetAttrib "avatar", "Male1.jpg"
Else c.SetAttrib "avatar", "X.jpg"
End If

This also holds for when the responses for BoyAvChoice are strings (a,b,c...) - so when the responses are NOT the same between GirlAvChoice and BoyAvChoice.


It also occurs when I keep the AvChoices separate, but in the same inline, e.g.:

If GirlAvChoice.RESP  = 1 Then
c.SetAttrib "avatar", "Female1.jpg"
ElseIf GirlAvChoice.RESP = 2 Then
c.SetAttrib "avatar", "Female2.jpg"
Else c.SetAttrib "avatar", "X.jpg"
End If

If BoyAvChoice.RESP  = 1 Then
c.SetAttrib "avatar", "Male1.jpg"
ElseIf BoyAvChoice.RESP = 2 Then
c.SetAttrib "avatar", "Male2.jpg"
Else c.SetAttrib "avatar", "X.jpg"
End If


and it occurs when they are in different inline scripts, one right after the other in the procedure.


The AvChoice slides are identical to one another except for the images that they carry, and I am at a bit of a loss as to how to proceed. Anyone come across this before?

Thanks,

Mika


arm...@uchicago.edu

unread,
Apr 3, 2018, 2:23:52 PM4/3/18
to E-Prime
To anyone who has a similar question...
 
Looks like it was related to .RESP variables being strings. Don't know why the error only popped up when 2 different slides were referenced (both were still .RESP slides), but putting the numbers in quotes took care of it:
Reply all
Reply to author
Forward
0 new messages