﻿<?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 4  » Count Button Presses in Trial with Fixed Duration</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Sun, 13 Sep 2026 00:06:47 GMT</lastBuildDate><ttl>20</ttl><item><title>Count Button Presses in Trial with Fixed Duration</title><link>https://forums.millisecond.com/Topic22895.aspx</link><description>Hi everyone,&lt;br/&gt;&lt;br/&gt;I'm trying to create a trial lasting 3 min in which participants have to press the spacebar every time they come up with an idea. I would like to count how many times the participant presses the spacebar and if possible at what exact points in time during the 3 min interval the presses took place.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;I would really appreciate any help as I seem to be stuck.</description><pubDate>Tue, 21 Nov 2017 02:27:02 GMT</pubDate><dc:creator>Pete</dc:creator></item><item><title /><link>https://forums.millisecond.com/Topic22921.aspx</link><description>Thank you very much! Works perfectly!&lt;br/&gt;&lt;br/&gt;</description><pubDate>Tue, 21 Nov 2017 02:27:02 GMT</pubDate><dc:creator>Pete</dc:creator></item><item><title>RE: Count Button Presses in Trial with Fixed Duration</title><link>https://forums.millisecond.com/Topic22899.aspx</link><description>&lt;div data-id="22895" class="if-quote-wrapper" unselectable="on" data-guid="1511195717085"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="22895" 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="22895" 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="22895" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Pete - Monday, November 20, 2017&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-22895"&gt;&lt;div class="if-quote-message-margin"&gt;Hi everyone,&lt;br/&gt;&lt;br/&gt;I'm trying to create a trial lasting 3 min in which participants have to press the spacebar every time they come up with an idea. I would like to count how many times the participant presses the spacebar and if possible at what exact points in time during the 3 min interval the presses took place.&amp;nbsp;&lt;br/&gt;&lt;br/&gt;I would really appreciate any help as I seem to be stuck.&lt;a class="if-quote-goto quote-link" href="#" data-id="22895"&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;You can achieve this using /isvalidresponse:&lt;br/&gt;&lt;br/&gt;&amp;lt;block ideablock&amp;gt;&lt;br/&gt;/ trials = [1=ideatrial]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial ideatrial&amp;gt;&lt;br/&gt;/ stimulusframes = [1=ideatext]&lt;br/&gt;/ validresponse = (57)&lt;br/&gt;/ isvalidresponse = [if (trial.ideatrial.response == 57) {values.spacebarcount +=1; values.keypresstimes = concat(concat(values.keypresstimes, trial.ideatrial.latency), ";"); false}]&lt;br/&gt;/ timeout = 30000&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/ spacebarcount = 0&lt;br/&gt;/ keypresstimes = ""&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text ideatext&amp;gt;&lt;br/&gt;/ items = ("Press the spacebar whenever you have an idea.")&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;data&amp;gt;&lt;br/&gt;/ columns = [date time subject group blocknum blockcode trialnum trialcode stimulusitem response latency &lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; values.spacebarcount values.keypresstimes]&lt;br/&gt;/ separatefiles = true&lt;br/&gt;&amp;lt;/data&amp;gt;&lt;br/&gt;&lt;br/&gt;You'll find the total number of spacebar presses logged in values.spacebarcount; you'll find a list of the exact times when the presses occurred in values.keypresstimes (in milliseconds, measured from the start of the trial).&lt;br/&gt;</description><pubDate>Mon, 20 Nov 2017 08:45:32 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>