﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 5  » select matching substrings of items 50% of the time?</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Thu, 17 Sep 2026 17:59:06 GMT</lastBuildDate><ttl>20</ttl><item><title>select matching substrings of items 50% of the time?</title><link>https://forums.millisecond.com/Topic26178.aspx</link><description>hi! I'm trying to write a script that, half the time, will pair items from picture and audio elements randomly for a trial. However, I also want to be able to set how frequently it samples matching files (i.e. 50% of the time, if "acorn.mp3" is selected from the video/audio element, "acorn.jpg" should be selected from the picture element).&amp;nbsp;&lt;br/&gt;&lt;br/&gt;I'm trying to build a toy example but I've gotten nowhere-- I wonder if there's a way to use the startswith function? Or if all the items appear in the same order I could use / select and have it select for the same index as the other element? But if I did that I'd have to create two sets of audio and video elements and I don't want items to repeat during the experiment, plus I'm not sure how I would randomize the selection order across the elements.&lt;br/&gt;&lt;br/&gt;Any thoughts appreciated!&lt;br/&gt;&lt;br/&gt;&amp;lt;picture pictures&amp;gt;&lt;br/&gt;/items=("acorn.jpg", "apple.jpg", "balloon.jpg")&lt;br/&gt;/ hposition = 50%&lt;br/&gt;/ vposition = 50%&lt;br/&gt;/ size = (300,300)&lt;br/&gt;&amp;lt;/picture&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;video audio&amp;gt;&lt;br/&gt;/items=("acorn.mp3", "apple.mp3", "balloon.mp3")&lt;br/&gt;&amp;lt;/video&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial trial&amp;gt;&lt;br/&gt;/ stimulusframes=[1=audio; 10=pictures]&lt;br/&gt;/ inputdevice=keyboard&lt;br/&gt;/ validresponse=(57)&lt;br/&gt;/ timeout = 1600&lt;br/&gt;&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;block myblock&amp;gt;&lt;br/&gt;/ trials = [1-3=trial]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;expt myexpt&amp;gt;&lt;br/&gt;/ blocks = [1=myblock]&lt;br/&gt;&amp;lt;/expt&amp;gt;&lt;br/&gt;</description><pubDate>Mon, 10 Dec 2018 19:46:47 GMT</pubDate><dc:creator>S F</dc:creator></item><item><title>RE: select matching substrings of items 50% of the time?</title><link>https://forums.millisecond.com/Topic26181.aspx</link><description>&lt;div data-id="26180" class="if-quote-wrapper" unselectable="on" data-guid="1544499837269"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="26180" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="26180" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="26180" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;S F - Monday, December 10, 2018&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-26180"&gt;&lt;div class="if-quote-message-margin"&gt;This is fantastic, thank you! I'm expanding it to have many more items and I've just scaled up the pool size in multiples of 6 (as well as the items) and incremented the trials in multiples of 4.&lt;a class="if-quote-goto quote-link" href="#" data-id="26180"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;Great! You are not restricted to multiples of 6 and 4, though, anything else works as well. For example, if you wanted to end up with, say, 45 match trials and 45 no-match trials (90 total), that would work out to 135 items needed.&lt;br/&gt;</description><pubDate>Mon, 10 Dec 2018 19:46:47 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: select matching substrings of items 50% of the time?</title><link>https://forums.millisecond.com/Topic26180.aspx</link><description>This is fantastic, thank you! I'm expanding it to have many more items and I've just scaled up the pool size in multiples of 6 (as well as the items) and incremented the trials in multiples of 4.</description><pubDate>Mon, 10 Dec 2018 19:07:11 GMT</pubDate><dc:creator>S F</dc:creator></item><item><title>RE: select matching substrings of items 50% of the time?</title><link>https://forums.millisecond.com/Topic26179.aspx</link><description>&lt;div data-id="26178" class="if-quote-wrapper" unselectable="on" data-guid="1544493389192"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="26178" title="Move Cursor Below" contenteditable="false"&gt;&lt;span unselectable="on"&gt;+&lt;/span&gt;&lt;/a&gt;&lt;a class="quote-delete" unselectable="on" style="display: none;" href="#" data-id="26178" title="Delete Quote" contenteditable="false"&gt;&lt;span unselectable="on"&gt;x&lt;/span&gt;&lt;/a&gt;&lt;span unselectable="on" class="quote-markup"&gt;[quote]&lt;/span&gt;&lt;div unselectable="on" class="if-quote-header" contenteditable="false"&gt;&lt;div unselectable="on" class="if-quote-toggle-wrapper"&gt;&lt;a class="if-quote-toggle quote-link" href="#" data-id="26178" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;S F - Monday, December 10, 2018&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-26178"&gt;&lt;div class="if-quote-message-margin"&gt;hi! I'm trying to write a script that, half the time, will pair items from picture and audio elements randomly for a trial. However, I also want to be able to set how frequently it samples matching files (i.e. 50% of the time, if "acorn.mp3" is selected from the video/audio element, "acorn.jpg" should be selected from the picture element).&amp;nbsp;&lt;br/&gt;&lt;br/&gt;I'm trying to build a toy example but I've gotten nowhere-- I wonder if there's a way to use the startswith function? Or if all the items appear in the same order I could use / select and have it select for the same index as the other element? But if I did that I'd have to create two sets of audio and video elements and I don't want items to repeat during the experiment, plus I'm not sure how I would randomize the selection order across the elements.&lt;br/&gt;&lt;br/&gt;Any thoughts appreciated!&lt;br/&gt;&lt;br/&gt;&amp;lt;picture pictures&amp;gt;&lt;br/&gt;/items=("acorn.jpg", "apple.jpg", "balloon.jpg")&lt;br/&gt;/ hposition = 50%&lt;br/&gt;/ vposition = 50%&lt;br/&gt;/ size = (300,300)&lt;br/&gt;&amp;lt;/picture&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;video audio&amp;gt;&lt;br/&gt;/items=("acorn.mp3", "apple.mp3", "balloon.mp3")&lt;br/&gt;&amp;lt;/video&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial trial&amp;gt;&lt;br/&gt;/ stimulusframes=[1=audio; 10=pictures]&lt;br/&gt;/ inputdevice=keyboard&lt;br/&gt;/ validresponse=(57)&lt;br/&gt;/ timeout = 1600&lt;br/&gt;&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;block myblock&amp;gt;&lt;br/&gt;/ trials = [1-3=trial]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;expt myexpt&amp;gt;&lt;br/&gt;/ blocks = [1=myblock]&lt;br/&gt;&amp;lt;/expt&amp;gt;&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="26178"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/div&gt;&lt;br/&gt;Something like this should do the trick:&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/ pictureitem = 1&lt;br/&gt;/ audioitem = 1&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;// 1 item is required for each "match" trial&lt;br/&gt;// 2 items are required for each "no match" trial&lt;br/&gt;// with 2 "match" trials and 2 "no match" trials,&lt;br/&gt;// we need (2 x 1) + (2 x 2) = 6 items&lt;br/&gt;// if no item is to repeat during the block&lt;br/&gt;&amp;lt;list itemnumbers&amp;gt;&lt;br/&gt;/ poolsize = 6&lt;br/&gt;/ selectionrate = always&lt;br/&gt;/ selectionmode = random&lt;br/&gt;/ replace = false&lt;br/&gt;&amp;lt;/list&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text pictures&amp;gt;&lt;br/&gt;/items=("a.jpg", "b.jpg", "c.jpg", "d.jpg", "e.jpg", "f.jpg")&lt;br/&gt;/ select = values.pictureitem&lt;br/&gt;/ position = (50%, 40%)&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text audio&amp;gt;&lt;br/&gt;/items=("a.mp3", "b.mp3", "c.mp3", "d.mp3", "e.mp3", "f.mp3")&lt;br/&gt;/ select = values.audioitem&lt;br/&gt;/ position = (50%, 60%)&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;// we sample one item number from the list&lt;br/&gt;// and use it for both audio and picture&lt;br/&gt;&amp;lt;trial match&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;values.audioitem = list.itemnumbers.nextindex;&lt;br/&gt;values.pictureitem = values.audioitem;&lt;br/&gt;]&lt;br/&gt;/ stimulusframes=[1=audio; 10=pictures]&lt;br/&gt;/ inputdevice=keyboard&lt;br/&gt;/ validresponse=(57)&lt;br/&gt;/ timeout = 1600&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;// we sample two item numbers from the list&lt;br/&gt;// one for the audio and a different one for the picture&lt;br/&gt;&amp;lt;trial nomatch&amp;gt;&lt;br/&gt;/ ontrialbegin = [&lt;br/&gt;values.audioitem = list.itemnumbers.nextindex;&lt;br/&gt;values.pictureitem = list.itemnumbers.nextindex;&lt;br/&gt;]&lt;br/&gt;/ stimulusframes=[1=audio; 10=pictures]&lt;br/&gt;/ inputdevice=keyboard&lt;br/&gt;/ validresponse=(57)&lt;br/&gt;/ timeout = 1600&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;// we sample match and no match trials in equal proportions&lt;br/&gt;&amp;lt;block myblock&amp;gt;&lt;br/&gt;/ trials = [1-4 = noreplace(match, nomatch)]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;expt myexpt&amp;gt;&lt;br/&gt;/ blocks = [1=myblock]&lt;br/&gt;&amp;lt;/expt&amp;gt;&lt;br/&gt;</description><pubDate>Mon, 10 Dec 2018 18:16:22 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>