﻿<?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  » Flexible   /items</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Sat, 26 Sep 2026 22:19:01 GMT</lastBuildDate><ttl>20</ttl><item><title>Flexible   /items</title><link>https://forums.millisecond.com/Topic23200.aspx</link><description>Hi Inquisit Team,&lt;br/&gt;&lt;br/&gt;I'm using the &amp;lt;port&amp;gt; element in Inquisit 5 and a d/a-changer to control a device for electrical stimulation (STMISOLA, BIOPAC). The d/a changer has a parallel port and transforms the 8-bit input from Inquisit to a 0-2,55V signal, which is used to control the electrical stimulator.&lt;br/&gt;&lt;br/&gt;Because of individual differences in sensitivity to electrical stimuli in humans, we need our scripts to be easily adjustable to individual thresholds of participants. Thus, we programmed &amp;lt;openended&amp;gt; elements in the beginning of our scripts, where we first register individual information for the stimulation as decimal numbers. Then, I want to use the openended.NAME.response to flexibly adjust the /items attribute of the &amp;lt;port&amp;gt; element with a given formula. E.g., if stimulating with 6.4mA, I need the port to output the number 64. I tried incorporating my formula [&amp;lt;%(openended.schmerz.response + 0.6* (openended.toleranz.response - openended.schmerz.response)*10%&amp;gt;]in the /items attribute [/ items = (&amp;lt;%openended.schmerz.response + 0.6* (openended.toleranz.response - openended.schmerz.response)*10%&amp;gt;)], which gave me an error:&lt;br/&gt;"-1 is invalid. Value must greater than 0."&lt;br/&gt;&lt;br/&gt;Next, I defined this as an &amp;lt;item&amp;gt;, e.g. named staerke60, and tried to read in this in the &amp;lt;port&amp;gt; element. Interestingly, now the scripts starts, but again produces errors after finishing/quitting, e.g.:&lt;br/&gt;'64' is not a valid setting.&lt;br/&gt;&lt;br/&gt;I found in the description for &amp;lt;item&amp;gt;, that in ports they must be written as binaries in "". However, the in the &amp;lt;port&amp;gt; and respective / items description, using decimals in parantheses is mentioned, too. And when using decimals regularily, not flexibly via &amp;lt;% %&amp;gt;, it works just fine. &lt;br/&gt;So am I correct, that the error occurs, because my calculation in &amp;lt;% %&amp;gt; produces a decimal, but when using a calculation, the &amp;lt;port&amp;gt; only accepts binaries? If so, do you know any simple and short workaround for this? I'm not sure, if I can again transform my decimal do a 8bit binary with the mathematical operations included in Inquisit, but maybe you have more experience with that? &lt;br/&gt;Another option could be defining every decimal from 0 to 255 in a single &amp;lt;port&amp;gt; element each and choosing these elements flexibly based on the openended value. However, that would heavily enlarge the script, which I would like to avoid if anyhow possible.&lt;br/&gt;&lt;br/&gt;Thanks a lot in advance for any help and suggestions.&lt;br/&gt;Best,&lt;br/&gt;Mattis&lt;br/&gt;&lt;br/&gt;PS.: the script is attached. Sorry for the German parts here and there, but I hope it is still understandable.</description><pubDate>Wed, 17 Jan 2018 00:54:04 GMT</pubDate><dc:creator>Mattis</dc:creator></item><item><title>RE: Flexible   /items</title><link>https://forums.millisecond.com/Topic23233.aspx</link><description>Thanks for the quick reply. Both solutions are very helpful - thanks a lot!&lt;br/&gt;&lt;br/&gt;</description><pubDate>Wed, 17 Jan 2018 00:54:04 GMT</pubDate><dc:creator>Mattis</dc:creator></item><item><title>RE: Flexible   /items</title><link>https://forums.millisecond.com/Topic23205.aspx</link><description>&lt;div data-id="23200" class="if-quote-wrapper" unselectable="on" data-guid="1515780063192"&gt;&lt;a class="quote-para" unselectable="on" style="display: none;" href="#" data-id="23200" 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="23200" 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="23200" title=" "&gt;&lt;/a&gt;&lt;/div&gt;&lt;span unselectable="on" class="quote-markup"&gt;[b]&lt;/span&gt;Mattis - Friday, January 12, 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-23200"&gt;&lt;div class="if-quote-message-margin"&gt;Hi Inquisit Team,&lt;br/&gt;&lt;br/&gt;I'm using the &amp;lt;port&amp;gt; element in Inquisit 5 and a d/a-changer to control a device for electrical stimulation (STMISOLA, BIOPAC). The d/a changer has a parallel port and transforms the 8-bit input from Inquisit to a 0-2,55V signal, which is used to control the electrical stimulator.&lt;br/&gt;&lt;br/&gt;Because of individual differences in sensitivity to electrical stimuli in humans, we need our scripts to be easily adjustable to individual thresholds of participants. Thus, we programmed &amp;lt;openended&amp;gt; elements in the beginning of our scripts, where we first register individual information for the stimulation as decimal numbers. Then, I want to use the openended.NAME.response to flexibly adjust the /items attribute of the &amp;lt;port&amp;gt; element with a given formula. E.g., if stimulating with 6.4mA, I need the port to output the number 64. I tried incorporating my formula [&amp;lt;%(openended.schmerz.response + 0.6* (openended.toleranz.response - openended.schmerz.response)*10%&amp;gt;]in the /items attribute [/ items = (&amp;lt;%openended.schmerz.response + 0.6* (openended.toleranz.response - openended.schmerz.response)*10%&amp;gt;)], which gave me an error:&lt;br/&gt;"-1 is invalid. Value must greater than 0."&lt;br/&gt;&lt;br/&gt;Next, I defined this as an &amp;lt;item&amp;gt;, e.g. named staerke60, and tried to read in this in the &amp;lt;port&amp;gt; element. Interestingly, now the scripts starts, but again produces errors after finishing/quitting, e.g.:&lt;br/&gt;'64' is not a valid setting.&lt;br/&gt;&lt;br/&gt;I found in the description for &amp;lt;item&amp;gt;, that in ports they must be written as binaries in "". However, the in the &amp;lt;port&amp;gt; and respective / items description, using decimals in parantheses is mentioned, too. And when using decimals regularily, not flexibly via &amp;lt;% %&amp;gt;, it works just fine. &lt;br/&gt;So am I correct, that the error occurs, because my calculation in &amp;lt;% %&amp;gt; produces a decimal, but when using a calculation, the &amp;lt;port&amp;gt; only accepts binaries? If so, do you know any simple and short workaround for this? I'm not sure, if I can again transform my decimal do a 8bit binary with the mathematical operations included in Inquisit, but maybe you have more experience with that? &lt;br/&gt;Another option could be defining every decimal from 0 to 255 in a single &amp;lt;port&amp;gt; element each and choosing these elements flexibly based on the openended value. However, that would heavily enlarge the script, which I would like to avoid if anyhow possible.&lt;br/&gt;&lt;br/&gt;Thanks a lot in advance for any help and suggestions.&lt;br/&gt;Best,&lt;br/&gt;Mattis&lt;br/&gt;&lt;br/&gt;PS.: the script is attached. Sorry for the German parts here and there, but I hope it is still understandable.&lt;a class="if-quote-goto quote-link" href="#" data-id="23200"&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;Try something like this:&lt;br/&gt;&lt;br/&gt;&amp;lt;expressions&amp;gt;&lt;br/&gt;/ s60 = evaluate((openended.schmerz.response + 0.6* (openended.toleranz.response - openended.schmerz.response))*10)&lt;br/&gt;/ s70 = evaluate((openended.schmerz.response + 0.7* (openended.toleranz.response - openended.schmerz.response))*10)&lt;br/&gt;/ s80 = evaluate((openended.schmerz.response + 0.8* (openended.toleranz.response - openended.schmerz.response))*10)&lt;br/&gt;/ s90 = evaluate((openended.schmerz.response + 0.9* (openended.toleranz.response - openended.schmerz.response))*10)&lt;br/&gt;/ s95 = evaluate((openended.schmerz.response + 0.95* (openended.toleranz.response - openended.schmerz.response))*10)&lt;br/&gt;&amp;lt;/expressions&amp;gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;********************************************************************************************&lt;br/&gt;******PARALLEL PORT TRIGGERS********&lt;br/&gt;********************************************************************************************&lt;br/&gt;&lt;br/&gt;&amp;lt;port pain_on60&amp;gt;&lt;br/&gt;/ items = (0)&lt;br/&gt;/ port = lpt1&lt;br/&gt;/ subport = data&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;port pain_on70&amp;gt;&lt;br/&gt;/ items = (0)&lt;br/&gt;/ port = lpt1&lt;br/&gt;/ subport = data&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;port pain_on80&amp;gt;&lt;br/&gt;/ items = (0)&lt;br/&gt;/ port = lpt1&lt;br/&gt;/ subport = data&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;port pain_on90&amp;gt;&lt;br/&gt;/ items = (0)&lt;br/&gt;/ port = lpt1&lt;br/&gt;/ subport = data&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;port pain_on95&amp;gt;&lt;br/&gt;/ items = (0)&lt;br/&gt;/ port = lpt1&lt;br/&gt;/ subport = data&lt;br/&gt;&amp;lt;/port&amp;gt;&lt;br/&gt;&lt;br/&gt;with&lt;br/&gt;&lt;br/&gt;&amp;lt;block preperation&amp;gt;&lt;br/&gt;/ onblockend = [&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port.pain_on60.setitem(expressions.s60, 1);&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port.pain_on70.setitem(expressions.s70, 1);&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port.pain_on80.setitem(expressions.s80, 1);&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port.pain_on90.setitem(expressions.s90, 1);&lt;br/&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; port.pain_on95.setitem(expressions.s95, 1);&lt;br/&gt;]&lt;br/&gt;/ trials = [1=schmerz; 2=toleranz; 3=start]&lt;br/&gt;&amp;nbsp;/preinstructions = (welcome)&lt;br/&gt;&amp;lt;/block&amp;gt;&lt;br/&gt;&lt;br/&gt;You need to make sure that your values stay within range, though, i.e. if any of the expressions take on a decimal value greater than 255, you'll encounter errors.&lt;br/&gt;&lt;br/&gt;Alternatively, if you prefer to convert from a decimal to an 8-bit binary string, this can be implemented like so: &lt;a href="https://www.millisecond.com/forums/FindPost4530.aspx"&gt;https://www.millisecond.com/forums/FindPost4530.aspx&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hope this helps.&lt;br/&gt;</description><pubDate>Fri, 12 Jan 2018 10:37:51 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>