﻿<?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  » Dynamically changing values stored in list</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Thu, 30 Apr 2026 13:24:19 GMT</lastBuildDate><ttl>20</ttl><item><title>Dynamically changing values stored in list</title><link>https://forums.millisecond.com/Topic28776.aspx</link><description>I am rather self-taught in programming these experiments and tend to do things a bit unconventionally, sometimes. But maybe you can help me again (as you have done before). &lt;br/&gt;&lt;br/&gt;I built a very complicated trial, which I want to “recycle” (repeat). That works perfectly fine using lists, except for storing/saving values within those trials. &lt;br/&gt;&lt;br/&gt;In my script I run through the same block multiple times. With the help of lists, I can change the stimuli dynamically. But I do not know, how to dynamically save values, for a repeated block.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;What I want:&lt;/strong&gt; Save the value.current_click (similar to a counter) dynamically.&lt;br/&gt;&lt;strong&gt;My approach:&lt;/strong&gt; I have a list with the values&lt;br/&gt;&lt;br/&gt;[code]&amp;lt;list list_responses&amp;gt;&lt;br/&gt;/items = (values.DRAWStrial1, values.DRAWStrial2, values.DRAWStrial3)&lt;br/&gt;/selectionmode = (values.current_list)&lt;br/&gt;&amp;lt;/list&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/DRAWStrial1 = -88&lt;br/&gt;/DRAWStrial2 = -88&lt;br/&gt;/DRAWStrial3 = -88&lt;br/&gt;&amp;lt;/values&amp;gt;[/code]&lt;br/&gt;&lt;br/&gt;Then, at the end of the block, I want to simply change the current value in the list. My most intuitive approach was /onblockend = [list.list_responses.nextvalue=values.current_click] but it says “the expression attempts to set the value of read-only property”:&lt;br/&gt;[code]&amp;lt;block someblock&amp;gt;&lt;br/&gt;/trials = [1-12 = trial_choose]&lt;br/&gt;/onblockend = [list.list_responses.nextvalue=values.current_click]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;expt&amp;gt;&lt;br/&gt;/ blocks = [1-3= someblock]&lt;br/&gt;&amp;lt;/expt&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;summarydata&amp;gt;&lt;br/&gt;/ columns = [values.DRAWStrial1, values.DRAWStrial2, values.DRAWStrial3]&lt;br/&gt;&amp;lt;/summarydata&amp;gt;[/code]&lt;br/&gt;&lt;br/&gt;I tried other functions like &lt;br/&gt;[code]/onblockend = [list.list_responses.setitem(values.current_click, values.current_list)] [/code]and &lt;br/&gt;[code]/onblockend = [ list.list_responses.item(values.current_list)=values.current_click][/code]&lt;br/&gt;Not always I get an error message, but it never saves the value.current_click to the values “stored” in my list list_responses to be saved in summarydata. The value always stays at the value -88 (pre-defined at the beginning of script).&lt;br/&gt;&lt;br/&gt;&lt;i&gt;Another idea&lt;/i&gt; I had was to create values somehow on the fly using dynamically created strings. For this I would need to convert my “list-counter” to a string, concatenate this to “value. DRAWStrial” and save the values.current_click to it.&lt;br/&gt;Any help appreciated! Thanks a lot! 😊&lt;br/&gt;</description><pubDate>Tue, 21 Apr 2020 07:22:00 GMT</pubDate><dc:creator>Tahwan</dc:creator></item><item><title>RE: Dynamically changing values stored in list</title><link>https://forums.millisecond.com/Topic28796.aspx</link><description>&lt;blockquote data-id="28786" class="if-quote-wrapper" unselectable="on" data-guid="1587453601636" id="if_insertedNode_1587453600387" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="28786" 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="28786" 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="28786" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Dave - 4/20/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-28786"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;&lt;blockquote data-id="28782" class="if-quote-wrapper" unselectable="on" data-guid="1587453601636" id="if_insertedNode_1587380069953" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="28782" 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="28782" 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="28782" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Jakob - 4/19/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-28782"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;Thank you very much for the fast reply. That would do the job. This is probably the best approach for Inquisit, I guess. Yet, I was looking for a more "dynamically approach", as I have ten or more trials, and per trial I want to save more than one value. That would mean lots of hardcoded lines. Thats why I came up the idea to use a list with values, trough which I am itterating with a counter (values.current_list) and to change the list's element (values) dynamically.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="28782"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;You can use &amp;lt;list&amp;gt;s, but there's no point in using values as the list's items.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="28786"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;Thank you. I thought that would be an easier and more elegant way to store values from a repeated trial. But I guess I will have to do it with the if statements with expressions for each repeated trial. Thank you for this suggestion!</description><pubDate>Tue, 21 Apr 2020 07:22:00 GMT</pubDate><dc:creator>Tahwan</dc:creator></item><item><title>RE: Dynamically changing values stored in list</title><link>https://forums.millisecond.com/Topic28786.aspx</link><description>&lt;blockquote data-id="28782" class="if-quote-wrapper" unselectable="on" data-guid="1587380070860" id="if_insertedNode_1587380069953" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="28782" 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="28782" 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="28782" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Jakob - 4/19/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-28782"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;Thank you very much for the fast reply. That would do the job. This is probably the best approach for Inquisit, I guess. Yet, I was looking for a more "dynamically approach", as I have ten or more trials, and per trial I want to save more than one value. That would mean lots of hardcoded lines. Thats why I came up the idea to use a list with values, trough which I am itterating with a counter (values.current_list) and to change the list's element (values) dynamically.&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="28782"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;You can use &amp;lt;list&amp;gt;s, but there's no point in using values as the list's items.&lt;br/&gt;</description><pubDate>Mon, 20 Apr 2020 10:55:53 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: Dynamically changing values stored in list</title><link>https://forums.millisecond.com/Topic28782.aspx</link><description>Thank you very much for the fast reply. That would do the job. This is probably the best approach for Inquisit, I guess. Yet, I was looking for a more "dynamically approach", as I have ten or more trials, and per trial I want to save more than one value. That would mean lots of hardcoded lines. Thats why I came up the idea to use a list with values, trough which I am itterating with a counter (values.current_list) and to change the list's element (values) dynamically.&lt;br/&gt;</description><pubDate>Sun, 19 Apr 2020 09:23:20 GMT</pubDate><dc:creator>Tahwan</dc:creator></item><item><title>RE: Dynamically changing values stored in list</title><link>https://forums.millisecond.com/Topic28780.aspx</link><description>&lt;blockquote data-id="28776" class="if-quote-wrapper" unselectable="on" data-guid="1587247505631" id="if_insertedNode_1587247504330" contenteditable="false"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="28776" 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="28776" 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="28776" title=" "&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Jakob - 4/18/2020&lt;span unselectable="on" class="quote-markup"&gt;[/b]&lt;/span&gt;&lt;/div&gt;&lt;div class="if-quote-message if-quote-message-28776"&gt;&lt;div class="if-quote-message-margin" contenteditable="true"&gt;I am rather self-taught in programming these experiments and tend to do things a bit unconventionally, sometimes. But maybe you can help me again (as you have done before). &lt;br/&gt;&lt;br/&gt;I built a very complicated trial, which I want to “recycle” (repeat). That works perfectly fine using lists, except for storing/saving values within those trials. &lt;br/&gt;&lt;br/&gt;In my script I run through the same block multiple times. With the help of lists, I can change the stimuli dynamically. But I do not know, how to dynamically save values, for a repeated block.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;What I want:&lt;/strong&gt; Save the value.current_click (similar to a counter) dynamically.&lt;br/&gt;&lt;strong&gt;My approach:&lt;/strong&gt; I have a list with the values&lt;br/&gt;&lt;br/&gt;[code]&amp;lt;list list_responses&amp;gt;&lt;br/&gt;/items = (values.DRAWStrial1, values.DRAWStrial2, values.DRAWStrial3)&lt;br/&gt;/selectionmode = (values.current_list)&lt;br/&gt;&amp;lt;/list&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;values&amp;gt;&lt;br/&gt;/DRAWStrial1 = -88&lt;br/&gt;/DRAWStrial2 = -88&lt;br/&gt;/DRAWStrial3 = -88&lt;br/&gt;&amp;lt;/values&amp;gt;[/code]&lt;br/&gt;&lt;br/&gt;Then, at the end of the block, I want to simply change the current value in the list. My most intuitive approach was /onblockend = [list.list_responses.nextvalue=values.current_click] but it says “the expression attempts to set the value of read-only property”:&lt;br/&gt;[code]&amp;lt;block someblock&amp;gt;&lt;br/&gt;/trials = [1-12 = trial_choose]&lt;br/&gt;/onblockend = [list.list_responses.nextvalue=values.current_click]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;expt&amp;gt;&lt;br/&gt;/ blocks = [1-3= someblock]&lt;br/&gt;&amp;lt;/expt&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;summarydata&amp;gt;&lt;br/&gt;/ columns = [values.DRAWStrial1, values.DRAWStrial2, values.DRAWStrial3]&lt;br/&gt;&amp;lt;/summarydata&amp;gt;[/code]&lt;br/&gt;&lt;br/&gt;I tried other functions like &lt;br/&gt;[code]/onblockend = [list.list_responses.setitem(values.current_click, values.current_list)] [/code]and &lt;br/&gt;[code]/onblockend = [ list.list_responses.item(values.current_list)=values.current_click][/code]&lt;br/&gt;Not always I get an error message, but it never saves the value.current_click to the values “stored” in my list list_responses to be saved in summarydata. The value always stays at the value -88 (pre-defined at the beginning of script).&lt;br/&gt;&lt;br/&gt;&lt;i&gt;Another idea&lt;/i&gt; I had was to create values somehow on the fly using dynamically created strings. For this I would need to convert my “list-counter” to a string, concatenate this to “value. DRAWStrial” and save the values.current_click to it.&lt;br/&gt;Any help appreciated! Thanks a lot! 😊&lt;br/&gt;&lt;a class="if-quote-goto quote-link" href="#" data-id="28776"&gt;&lt;span class="goto"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[/quote]&lt;/span&gt;&lt;/blockquote&gt;&lt;br/&gt;I have no idea what you're trying to do. You say you want to "change the current value in the list". What is the current value? You have three variables as that list's items. values.DRAWStrial1, values.DRAWStrial2, and values.DRAWStrial3. Simply set whatever value or values of those three to values.current_click. There's no reason to do anything with the list at all.&lt;br/&gt;&lt;br/&gt;&amp;lt;block someblock&amp;gt;&lt;br/&gt;/trials = [1-12 = trial_choose]&lt;br/&gt;/onblockend = [if (values.current_list == 1) {values.DRAWStrial1 = values.current_click};&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (values.current_list == 2) {values.DRAWStrial2 = values.current_click};&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (values.current_list == 3) {values.DRAWStrial3 = values.current_click};&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;]&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;</description><pubDate>Sat, 18 Apr 2020 22:13:37 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>