﻿<?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  » Getting the counter to reset when it hits 0</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Sun, 20 Sep 2026 03:18:31 GMT</lastBuildDate><ttl>20</ttl><item><title>Getting the counter to reset when it hits 0</title><link>https://forums.millisecond.com/Topic15738.aspx</link><description>Hello,&lt;br/&gt;&lt;br/&gt;I am designing an experiment in which participants can either earn money (incentive) or lose money (decentive) for correct guess per trial. For example, if it's an incentive block, participants will earn $.15 for each correct guess per trial within that block. But if the next block is a decentive block, they will lose $.05 for each correct guess.&lt;br/&gt;&lt;br/&gt;I'm using the counter element so that participants can keep track of their earnings. However, currently, as I've programmed the experiment, if participants lose money below $0, the program records negative numbers, but their counter amount shows $0. So, when participants start earning money again, they need to get out of the negative range before the counter will show anything over $0.&lt;br/&gt;&lt;br/&gt;Basically, I need to know how to get the counter to reset the participant's earnings to 0 when they dip into the negative digits (we are not interested in having participants owe money for this task). Would I do this using the reset interval attribute? Or would I need to fix something elsewhere in the code, outside the counter element?&lt;br/&gt;&lt;br/&gt;Please let me know if you'd like to see my code. Thank you!</description><pubDate>Tue, 10 Mar 2015 14:45:40 GMT</pubDate><dc:creator>aghartley</dc:creator></item><item><title>RE: Getting the counter to reset when it hits 0</title><link>https://forums.millisecond.com/Topic15739.aspx</link><description>I'm not sure why you would use a &amp;lt;counter&amp;gt; to keep track of earnings at all. The best-suited element for that is a &amp;lt;values&amp;gt; entry -- you simply update that value by adding or subtracting earnings or losses. Setting that value to zero if it goes negative is trivial.&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/ points = 0&lt;br/&gt;&amp;lt;/values&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;block myblock&amp;gt;&lt;br/&gt;/ trials = [1-10 = mytrial]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;trial mytrial&amp;gt;&lt;br/&gt;/ ontrialend = [if (trial.mytrial.response == 17) values.points += 10]&lt;br/&gt;/ ontrialend = [if (trial.mytrial.response == 38) values.points -= 10]&lt;br/&gt;/ ontrialend = [values.points=max(0,values.points)]&lt;br/&gt;/ stimulusframes = [1=mytext, mypoints]&lt;br/&gt;/ validresponse = ("w", "l")&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text mytext&amp;gt;&lt;br/&gt;/ items = ("Press 'W' to win points, press 'L' to lose points.")&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text mypoints&amp;gt;&lt;br/&gt;/ items = ("Your have &amp;lt;%values.points%&amp;gt; points")&lt;br/&gt;/ position = (50%, 10%)&lt;br/&gt;/ erase = false&lt;br/&gt;/ size = (25%, 10%)&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;A &amp;lt;counter&amp;gt;'s /resetinterval will not help you, nor will explicitly calling the reset() function on it. Neither changes the counter's *contents*, both merely reset it's selection pool.&lt;br/&gt;</description><pubDate>Tue, 10 Mar 2015 14:45:40 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>