﻿<?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  » Using replace function in position parameter throws syntax error</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Mon, 25 May 2026 20:02:26 GMT</lastBuildDate><ttl>20</ttl><item><title>Using replace function in position parameter throws syntax error</title><link>https://forums.millisecond.com/Topic12014.aspx</link><description>&lt;span class="code"&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;Hello Inquisitors!&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;I have a relatively simple problem but could not get my head around why my approach does not work.&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;Inquisit documentation gives a following example of using replace() function to get randomized picture position:&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;picture mypic&amp;gt;&lt;/div&gt;&lt;div&gt;/ items = ("foo.jpg")&lt;/div&gt;&lt;div&gt;/ position = (replace(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100), replace(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100))&lt;/div&gt;&lt;div&gt;&amp;lt;/picture&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;In my experiment I use the same syntax:&lt;/div&gt;&lt;div&gt;&amp;lt;picture negpic&amp;gt;&lt;/div&gt;&lt;div&gt;/ items = neg&lt;/div&gt;&lt;div&gt;/ position = (replace(15, 85), 50)&lt;/div&gt;&lt;div&gt;&amp;lt;/picture&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;but it gives me following errors:&lt;/div&gt;&lt;div&gt;Element: picture.negpic&lt;/div&gt;&lt;div&gt;Attribute: position&lt;/div&gt;&lt;div&gt;Message: Setting has invalid text ', 50)'.&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;Element: picture.negpic&lt;/div&gt;&lt;div&gt;Attribute:&amp;nbsp;&lt;/div&gt;&lt;div&gt;Message: Expression 'replace(15,' is invalid. Unmatched parenthesis.&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;However, my parentheses are matched, I have also checked around &lt;br/&gt;(before the definition of the picture and after) and everything seems to &lt;br/&gt;be a legitimate Inquisit syntax.&lt;/div&gt;&lt;div&gt;I have also tried using ';' instead of ',' or adding spaces - the error is the same.&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;Do you have any ideas why it might not work or what should be done to fix the problem?&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;</description><pubDate>Wed, 08 Jan 2014 23:16:45 GMT</pubDate><dc:creator>ImponDeRable</dc:creator></item><item><title>RE: Using replace function in position parameter throws syntax error</title><link>https://forums.millisecond.com/Topic12051.aspx</link><description>Documentation will be corrected in the next update.&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;Thanks,&lt;div&gt;Sean&lt;/div&gt;&lt;/div&gt;</description><pubDate>Wed, 08 Jan 2014 23:16:45 GMT</pubDate><dc:creator>seandr</dc:creator></item><item><title>RE: Using replace function in position parameter throws syntax error</title><link>https://forums.millisecond.com/Topic12022.aspx</link><description>Thanks a lot, Dave!&lt;br/&gt;Especially for the correct examples that you've posted before in this tread,&lt;br/&gt;they will save me some time.</description><pubDate>Thu, 02 Jan 2014 16:49:37 GMT</pubDate><dc:creator>ImponDeRable</dc:creator></item><item><title>RE: Using replace function in position parameter throws syntax error</title><link>https://forums.millisecond.com/Topic12019.aspx</link><description>I stand corrected. The functions reference does indeed give that flawed example, which I had overlooked at first. Thanks for pointing this out -- I will make sure the example gets replaced with a valid one.&lt;br/&gt;</description><pubDate>Thu, 02 Jan 2014 14:26:24 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: Using replace function in position parameter throws syntax error</title><link>https://forums.millisecond.com/Topic12018.aspx</link><description>Yes, I am well aware of the functions reference. However, I don't think any example gives the use case you are alleging in the /position attribute:&lt;div&gt;&lt;span class="code"&gt;&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;blockquote&gt;&lt;div&gt;"Inquisit documentation gives a following example of using replace() function to get randomized picture position:&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;div&gt;&amp;lt;picture mypic&amp;gt;&lt;/div&gt;&lt;div&gt;/ items = ("foo.jpg")&lt;/div&gt;&lt;div&gt;/ position = (replace(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100), replace(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100))&lt;/div&gt;&amp;lt;/picture&amp;gt;"&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;I have posted valid examples in my previous response.&lt;br/&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt; </description><pubDate>Thu, 02 Jan 2014 14:14:43 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: Using replace function in position parameter throws syntax error</title><link>https://forums.millisecond.com/Topic12017.aspx</link><description>By documentation I mean the full documentation of inquisit objects,&lt;br/&gt;otherwise known as help. :)&lt;br/&gt;&lt;br/&gt;You can find it under:&lt;br/&gt;Help --&amp;gt; Table of contents&lt;div&gt;&lt;br/&gt;&lt;/div&gt;then in the table of contents:&lt;br/&gt;&lt;div&gt;Language Reference --&amp;gt; Expressions --&amp;gt; Functions&lt;br/&gt;&lt;br/&gt;And then under selection functions there are examples where&lt;br/&gt;this way of using replace() is presented.&lt;/div&gt;</description><pubDate>Thu, 02 Jan 2014 14:10:06 GMT</pubDate><dc:creator>ImponDeRable</dc:creator></item><item><title>RE: Using replace function in position parameter throws syntax error</title><link>https://forums.millisecond.com/Topic12016.aspx</link><description>To clarify, the correct way to do this would be&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;font face="Courier New"&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;/ stimulusframes = [1=mytext]&lt;br/&gt;/ validresponse = (57)&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text mytext&amp;gt;&lt;br/&gt;/ items = ("A")&lt;br/&gt;/ hposition = replace(25%, 75%)&lt;br/&gt;/ vposition = replace(10%, 50%, 90%)&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;/font&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;or alternatively&lt;div&gt;&lt;br/&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;font face="Courier New"&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;/ stimulusframes = [1=mytext]&lt;br/&gt;/ validresponse = (57)&lt;br/&gt;&amp;lt;/trial&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;text mytext&amp;gt;&lt;br/&gt;/ items = ("A")&lt;br/&gt;/ position = (expressions.randpos, 40%)&lt;br/&gt;&amp;lt;/text&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;expressions&amp;gt;&lt;br/&gt;/ randpos = replace(25%, 75%)&lt;br/&gt;&amp;lt;/expressions&amp;gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;br/&gt;&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;/div&gt;The syntax in your /position attribute(s) is in fact not valid, as far as I am aware.&lt;br/&gt;</description><pubDate>Thu, 02 Jan 2014 14:06:26 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: Using replace function in position parameter throws syntax error</title><link>https://forums.millisecond.com/Topic12015.aspx</link><description>Where does the documentation give those examples?&lt;br/&gt;</description><pubDate>Thu, 02 Jan 2014 13:57:23 GMT</pubDate><dc:creator>Dave</dc:creator></item></channel></rss>