video.xxxx.currentitem does not return correct value


Author
Message
Jeff
Jeff
Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)
Group: Forum Members
Posts: 39, Visits: 97

I am trying to use the currentitem reference to a video element, but even though the correct video plays during the trial, the references to it returns the value of the previous item.  For example, if the first two items are "Item001" and "Item002", then during the first trial, "Item001" plays, during the second trial, "Item002" plays, but the references to video.prompt_snd.currentitem return "Item001" during both trials.  




<video Prompt_snd>


/ items = Prompt


/ select = values.Item_index


</video>



<text item_name>


   / items = (" <% video.prompt_snd.currentitem %>")


</text>



<trial test1_trials>


  / ontrialbegin = [expressions.Update_item_index]


    / ontrialbegin = [values.item_number = substring(video.prompt_snd.currentitem, 0, 8)]


...

</trial>






<expressions>


/ Update_item_index =


 if (values.block == 11) values.Item_index = counter.PK1_1_EBLMC_items.selectedvalue;


</expressions>





Attachments
currentitem reference demo.exp (626 views, 12.00 KB)
Dave
Dave
Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)
Group: Administrators
Posts: 9.9K, Visits: 49K

Since the simplified, yet analogous


<values>
/ Item_index = 0
</values>

<text mytext>
/ items = myitems
/ select = values.Item_index
/ position = (50%, 40%)
</text>

<text item_name>
/ items = (" Item name = <% text.mytext.currentitem %>")
/ position = (50%, 60%)
</text>

<item myitems>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
</item>

<trial mytrial>
/ ontrialbegin = [values.Item_index=noreplace(1,2,3,4)]
/ stimulusframes = [1=mytext, item_name]
/ validresponse = (anyresponse)
</trial>

<block myblock>
/ trials = [1-4=mytrial]
</block>


works perfectly fine as far as I can tell (also with <video> elements instead of <text>, I would suspect there is a mistake somewhere in your script's logic. Since the script you attached cannot be run due to the missing dependencies (picture, video and sound files), I can't tell you where that mistake may be. I would recommend you first make a simple test case script along the lines of the above, verify that it works as intended and then go back to the full script to track down the error(s).


Regards,


~Dave



Jeff
Jeff
Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)Guru (6.7K reputation)
Group: Forum Members
Posts: 39, Visits: 97

So I have a partial answer, with a followup question.  The two references (in the text element and Item_number assignment statement) were wrong because they occurred before the video.prompt_snd item was updated with the current item index.  When I moved the text element after the prompt_snd element in the stimulustimes line, the problem was fixed.  Similarly, when I moved the item_number assignment to ontrialend instead of ontrialbegin, that problem was fixed.  So my conclusion is that using this method, the currentitem is not updated until the element is called in the stimulustimes attribute.  Is that correct?  



Jeff


Dave
Dave
Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)Supreme Being (775K reputation)
Group: Administrators
Posts: 9.9K, Visits: 49K

So my conclusion is that using this method, the currentitem is not updated until the element is called in the stimulustimes attribute


Yes. Sampling for elements occurs in the order specified in /stimulusframes or /stimulustimes.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search