Using replace function in position parameter throws syntax error


Using replace function in position parameter throws syntax error

Author
Message
ImponDeRable
ImponDeRable
Respected Member
Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)

Group: Forum Members
Posts: 3, Visits: 15
Hello Inquisitors!

I have a relatively simple problem but could not get my head around why my approach does not work.

Inquisit documentation gives a following example of using replace() function to get randomized picture position:

<picture mypic>
/ items = ("foo.jpg")
/ 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))
</picture>


In my experiment I use the same syntax:
<picture negpic>
/ items = neg
/ position = (replace(15, 85), 50)
</picture>

but it gives me following errors:
Element: picture.negpic
Attribute: position
Message: Setting has invalid text ', 50)'.

Element: picture.negpic
Attribute: 
Message: Expression 'replace(15,' is invalid. Unmatched parenthesis.


However, my parentheses are matched, I have also checked around
(before the definition of the picture and after) and everything seems to
be a legitimate Inquisit syntax.
I have also tried using ';' instead of ',' or adding spaces - the error is the same.

Do you have any ideas why it might not work or what should be done to fix the problem?


Dave
Dave
Supreme Being
Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)

Group: Administrators
Posts: 9.8K, Visits: 46K
Where does the documentation give those examples?

Dave
Dave
Supreme Being
Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)

Group: Administrators
Posts: 9.8K, Visits: 46K
To clarify, the correct way to do this would be

<block myblock>
/ trials = [1-10=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("A")
/ hposition = replace(25%, 75%)
/ vposition = replace(10%, 50%, 90%)
</text>

or alternatively

<block myblock>
/ trials = [1-10=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("A")
/ position = (expressions.randpos, 40%)
</text>

<expressions>
/ randpos = replace(25%, 75%)
</expressions>


The syntax in your /position attribute(s) is in fact not valid, as far as I am aware.

ImponDeRable
ImponDeRable
Respected Member
Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)

Group: Forum Members
Posts: 3, Visits: 15
By documentation I mean the full documentation of inquisit objects,
otherwise known as help. Smile

You can find it under:
Help --> Table of contents

then in the table of contents:
Language Reference --> Expressions --> Functions

And then under selection functions there are examples where
this way of using replace() is presented.

Dave
Dave
Supreme Being
Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)

Group: Administrators
Posts: 9.8K, Visits: 46K
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:

"Inquisit documentation gives a following example of using replace() function to get randomized picture position:

<picture mypic>
/ items = ("foo.jpg")
/ 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))
</picture>"

I have posted valid examples in my previous response.

Edited
5 Years Ago by Dave
Dave
Dave
Supreme Being
Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)Supreme Being (678K reputation)

Group: Administrators
Posts: 9.8K, Visits: 46K
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.

ImponDeRable
ImponDeRable
Respected Member
Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)Respected Member (456 reputation)

Group: Forum Members
Posts: 3, Visits: 15
Thanks a lot, Dave!
Especially for the correct examples that you've posted before in this tread,
they will save me some time.
seandr
seandr
Supreme Being
Supreme Being (97K reputation)Supreme Being (97K reputation)Supreme Being (97K reputation)Supreme Being (97K reputation)Supreme Being (97K reputation)Supreme Being (97K reputation)Supreme Being (97K reputation)Supreme Being (97K reputation)Supreme Being (97K reputation)

Group: Administrators
Posts: 1.2K, Visits: 964
Documentation will be corrected in the next update.

Thanks,
Sean

GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search