By leluxe - 10/19/2015
I conducted a script that gets the participants displaysize as a value either by asking the participant to type it in a textbox, or by guiding the participant to find it out with the help of a line adjustable to the length of a credit card. For the latter I adapted the "Absolute Sizing"-Script - https://www.millisecond.com/forums/Topic14608.aspx?Keywords=absoulte%20sizing - and altered it for my purposes.
Now this script is supposed to do the following:
1. If a participant already knows his/her display size, he or she should be able to enter it directly without having to hold a credit card against the screen. After doing this he/she should be directly presented the first part of the actual experiment. => This works so far.
2. The experiment only allows for participants who use a display with at least 10.1 and with no more than 30 inches. If the participant adjusts the line in a way that it is very short or very long, indicating a very big or very small screen, I want the script to show a message with the display size, then a message that it doesn't fit and then stop the experiment after the participant pressing enter.
3. If the length of the line does fit though, I want the script to show a short message which tells the participant the size of his/her display and afterwards, as in point 1, directly present the first part of the actual experiment.
I'm struggling to set up the trial sequence in a way that points 2 and 3 work correctly. Either the experiment always ends after adjusting the line, even if its length is between 400 and 500 pixels (a value I chose for testing so that you don't have to click like crazy) or, if I change the succession of trials in the /block element, the experiment keeps on going even when the line is too short or too long, messing up the image presentation in the actual tasks of the script.
Also I find strange that after adjusting the line you have to confirm, wait for the message with the screen size to disappear and then confirm again. I don't know why it is like this, I would like the script to proceed directly after the message disappears.
I hope you can help me with this. I have a feeling that the issue is in defining this kind of branching with /ontrialend rather than /branch but my feeling didn't lead me to any solution so far. I wouldn't know how to set up the script so that it works correctly.
Attached you'll find the part of the script that is affected (comments are in German).
By Dave - 10/19/2015
To invoke a trial, you *must* use /branch. You absolutely cannot invoke a trial using /ontrialend, that's simply not its purpose.
Also, since you *do not know* which trials ought to be run in the <block>, you cannot specify what trials to run in the <blocks> /trials attribute except for the very 1st one. The rest is all determined at runtime, depending on whatever the participant responds, i.e. using conditional branching.
By leluxe - 10/19/2015
Thanks Dave, you're amazing!
I actually used /branch before but it turned out that the "doesntwork" trial started directly as soon as the length of the line reached too extreme values, without being able to click confirm. So I concluded /ontrialend must be the attribute of choice, which now I know absolutely isn't. Don't know what I did wrong back then, but now it works perfectly.
By Dave - 10/20/2015
> I actually used /branch before but it turned out that the "doesntwork" trial started directly as soon as the length of the line
> reached too extreme values, without being able to click confirm.
I can clarify why that was the case. When you have multiple /branch attributes in a <trial>, their *order* matters. You must have had something along the lines of:
/ branch = [if (values.linelength_px<400) trial.doesntwork]
/ branch = [if (values.linelength_px>500) trial.doesntwork]
/ branch = [if (trial.changelinelength.response != "confirm") trial.changelinelength]
The *first* /branch that evaluates to 'true' is executed, i.e., " the "doesntwork" trial started directly as soon as the length of the line reached too extreme values" is exactly what you instructed the script to do.
By leluxe - 10/20/2015
Ah I see, that explains it.