Error in list example in help


Author
Message
PiotrW
PiotrW
Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)
Group: Forum Members
Posts: 9, Visits: 13

Hello


I am using the latest Inquisit for Mac.


I tried with no success numerous variants of expressions based on the following example in help:


<list evenodd>
/ selectionmode = sequence
/ items = [if ( floor(mod(block.test.currenttrialnumber, 2)) == 0 ) 1 else 2]
</list>


Finally I just copied the very text of the example only to discover that it would not work either! Error message:


"Expression 'floor(mod(block.test.currenttrialnumber,2' is invalid. Unmatched parenthesis."



Even a much simplified version was wrong:


/ items = [if ((2 + 2) == 4) 1 else 2]


Error:  Expression '(2+2' is invalid. Unmatched parenthesis.



phrase [if (1 == 1) 1 else 2]  gives: Expression '==' is invalid. Expression contains a syntax error.


same but without spaces at == 


[if (1==1) 1 else 2]


neither launches the error message nor prevents the script from running, but does not work as intended too.



What is the proper way of conditional list definition?


P.S. I would appreciate any clues as to what types of expressions / operators are allowed where. Are there any resources available? I found only a note in the help that most Java or similar conventions should feel familiar to those who know these languages, but I happen to know only old school tools: some of assembler, basic and pascal ;-)


Best


Piotr






Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

This looks like a bug in Inquisit's expression parser, not necessarily an error in the example. I've filed a bug report, thanks for pointing this out.


What is the proper way of conditional list definition?


Tell me what exactly you want to do and I'll try to give you a working solution.


P.S. I would appreciate any clues as to what types of expressions / operators are allowed where. Are there any resources available?


In the documentation see the "Language Reference" section -> "Expressions" subsection which includes


- operator reference,


- functions reference,


- conditional statements


The syntax is virtually identical to what you'll find in the C-style family of languages (which includes Java). Expressions may be inserted wherever the language reference for a given attribute says so. Common locations would be


- the <expressions> element (unsurprisingly),


- event attributes (/ontrialbegin, /ontrialend, etc.)


- stimuli's /size or /position attributes.



PiotrW
PiotrW
Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)
Group: Forum Members
Posts: 9, Visits: 13


In the documentation see the "Language Reference" section -> "Expressions" subsection which includes


- operator reference,


- functions reference,


- conditional statements




Dave,


At first I was completely at see and thougt it was all just my beginners problem, but now I am not so sure.


Please check for yourself, but I was able to find links to the pages you recommended only with google:


eg. http://www.millisecond.com/support/docs/v4/html/language/express.htm


help on Mac as well as the online version point to this document:


http://www.millisecond.com/support/docs/v4/html/language/elements/expressions.htm


same problem with links to documents on operators, special characters, and <instructions> syntax: was not able to find them via the help menus (neither web nor built in). Search for "expressions" on your webpage produces link to "expressions element" rather than "expressions". Same with the built-in help. The latter is no use with the remaining documents too.



To add insult to injury, the Java menu at http://www.millisecond.com/support/docs/v4/index.htm     does not seem to work in Safari (I have installed the latest Java just to get it working, but it displays only unresponsive garbage)



Please check if it is me doing something wrong, or the links are broken.


Best


Piotr





Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

As far as I understand, the help system for Inquisit Lab on the Mac is currently a bit different and more limited compared the one on Windows. For the most part it lacks a proper navigation facilities and a tree-style TOC. I'm sure this will improve over time. (I myself am not a Mac user.)


I am not sure why the online docs don't work for you in Safari. The docs are there and linked via the TOC, though, as detailed in my previous reply.


http://www.millisecond.com/support/docs/v4/html/language/express.htm


http://www.millisecond.com/support/docs/v4/html/language/expressions/operators.htm


http://www.millisecond.com/support/docs/v4/html/language/expressions/functions.htm


http://www.millisecond.com/support/docs/v4/html/language/expressions/constants.htm


http://www.millisecond.com/support/docs/v4/html/language/expressions/conditional.htm


PiotrW
PiotrW
Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)Partner Member (981 reputation)
Group: Forum Members
Posts: 9, Visits: 13

Dave, 


Apple issued a Java for OS X update 2013-003 on Apr 16th that has cleared the not working TOC problem in Safari for me.



Now I am able to see that the language reference index page misses some of the references that are present in the java TOC.


Unfortunately, the built-in help on mac is identical with your help on the web minus the java TOC, so it inherits the problem of unlinked pages.



A simple cure would be just updating the index page: http://www.millisecond.com/support/docs/v4/index.htm


with those few links that are present exclusively in the Java TOC. The same should of course be done with the copy in the built-in help.


Such update would also help those users who do not have or block Java for security reasons.



Hope this was helpful.


Best


Piotr




GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search