Conditional branching


Author
Message
Psych_Josh
Psych_Josh
Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)
Group: Forum Members
Posts: 85, Visits: 397
Dave - Wednesday, April 26, 2017
Psych_Josh - Wednesday, April 26, 2017
Hi Dave - hopefully this is my last query - I was wondering if it were possible to use a list element for a timeout attribute? I'm afraid the simple answer might be no - however, I would like to essentially terminate a trial after a random interval, so that I have:

<list waiting>
/items = (300, 400, 500, 650, 800, 1000, 1500)
/poolsize = 7
/replace = true
/selectionmode = random
</list>

<trial waiting_s_1_500>
/stimulustimes = [100 = waitingstim]
/timeout = [list.waiting.nextvalue]
/branch = [trial.selftraining1countdownprac500]
</trial>

etc.

However, as you can imagine, Inquisit tells me that it contains an unknown element or property name - would it be possible to point me in the right direction (and I apologise if the solution is frustratingly simple)?

Many thanks,
Josh

Yes. It's perfectly possible to do. The proper syntax should be

/ timeout = list.waiting.nextvalue

Hi Dave - many thanks - I had made a mistake in placing squared brackets around list.waiting.nextvalue, which was producing an error message.

Thanks again!
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: 13K, Visits: 104K
Psych_Josh - Wednesday, April 26, 2017
Hi Dave - hopefully this is my last query - I was wondering if it were possible to use a list element for a timeout attribute? I'm afraid the simple answer might be no - however, I would like to essentially terminate a trial after a random interval, so that I have:

<list waiting>
/items = (300, 400, 500, 650, 800, 1000, 1500)
/poolsize = 7
/replace = true
/selectionmode = random
</list>

<trial waiting_s_1_500>
/stimulustimes = [100 = waitingstim]
/timeout = [list.waiting.nextvalue]
/branch = [trial.selftraining1countdownprac500]
</trial>

etc.

However, as you can imagine, Inquisit tells me that it contains an unknown element or property name - would it be possible to point me in the right direction (and I apologise if the solution is frustratingly simple)?

Many thanks,
Josh

Yes. It's perfectly possible to do. The proper syntax should be

/ timeout = list.waiting.nextvalue

Psych_Josh
Psych_Josh
Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)
Group: Forum Members
Posts: 85, Visits: 397
Hi Dave - hopefully this is my last query - I was wondering if it were possible to use a list element for a timeout attribute? I'm afraid the simple answer might be no - however, I would like to essentially terminate a trial after a random interval, so that I have:

<list waiting>
/items = (300, 400, 500, 650, 800, 1000, 1500)
/poolsize = 7
/replace = true
/selectionmode = random
</list>

<trial waiting_s_1_500>
/stimulustimes = [100 = waitingstim]
/timeout = [list.waiting.nextvalue]
/branch = [trial.selftraining1countdownprac500]
</trial>

etc.

However, as you can imagine, Inquisit tells me that it contains an unknown element or property name - would it be possible to point me in the right direction (and I apologise if the solution is frustratingly simple)?

Many thanks,
Josh
Psych_Josh
Psych_Josh
Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)
Group: Forum Members
Posts: 85, Visits: 397
Hi Dave,

I tried various formats, and thankfully .mov did not encounter the error - thanks for your suggestion.

Josh
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: 13K, Visits: 104K
Psych_Josh - Tuesday, April 25, 2017
Hi Dave, thank you very much for you assistance - I thought latency and elapsed time would operate similarly in this instance, but your fix has provided relief!

I have another small, unrelated problem that has arisen - I can start another 'Question' or thread if you'd prefer, but, for now, I am having trouble with a video stimulus not fully erasing after presentation. Essentially I present a video stimulus, and whenever it continues to the next screen (whether it's another trial or block), a white shape of the same area/size as the video (in this instance, a medium-sized square) persists and covers up anything presented afterwards. I've tried multiple methods to my knowledge, but I still cannot remove it/prevent it from happening. If you could point me in the right direction if/when you have time, that would be very much appreciated.


<trial 1>
/stimulustimes = [1 = clock; 1999 = whiterectangle]
/correctresponse = (57)
/branch = [trial.2]
</trial>

<trial 2>
/stimulustimes = [1 = connecting2]
/correctresponse = (57)
</trial>

<block FUCK>
/trials = [1 = 1; 2 = 2]
</block>


<item connecting>
/1 = "Now you will begin the main experiment.

Press space to search for another Prolific Academic user."
</item>

<text connecting>
/fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/txcolor = (black)
/items = connecting
</text>

<trial connecting>
/stimulustimes = [1 = connecting]
/correctresponse = (57)
/branch = [trial.waiting]
</trial>

-----

<video clock>
/items = ("libet0.avi")
/playthrough = false
/loop = true
/size = (20%, 20%)
</video>

<item waiting>
/1 = "Please wait while we connect you to another user..."
</item>

<text waiting>
/fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/txcolor = (black)
/items = waiting
/position = (50, 80)
</text>

<trial waiting>
/stimulustimes = [1 = clock, waiting]
/timeout = 1000
</trial>

-----

<item connecting2>
/1 = "You are now connected with another Prolific Academic user!

Press the space bar to continue."
</item>

<text connecting2>
/fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/txcolor = (black)
/items = connecting2
</text>

<trial connecting2>
/stimulustimes = [1 = connecting2]
/correctresponse = (57)
</trial>

-----

<block connecting>
/trials = [1 = connecting; 2 = waiting; 3 = connecting2]
</block>

Many thanks,
Josh

Hmm, no spontaneous idea.
(1) Is your Inquisit installation up to date?
(2) Have you tried a different video format?


Psych_Josh
Psych_Josh
Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)
Group: Forum Members
Posts: 85, Visits: 397
Hi Dave, thank you very much for you assistance - I thought latency and elapsed time would operate similarly in this instance, but your fix has provided relief!

I have another small, unrelated problem that has arisen - I can start another 'Question' or thread if you'd prefer, but, for now, I am having trouble with a video stimulus not fully erasing after presentation. Essentially I present a video stimulus, and whenever it continues to the next screen (whether it's another trial or block), a white shape of the same area/size as the video (in this instance, a medium-sized square) persists and covers up anything presented afterwards. I've tried multiple methods to my knowledge, but I still cannot remove it/prevent it from happening. If you could point me in the right direction if/when you have time, that would be very much appreciated.


<trial 1>
/stimulustimes = [1 = clock; 1999 = whiterectangle]
/correctresponse = (57)
/branch = [trial.2]
</trial>

<trial 2>
/stimulustimes = [1 = connecting2]
/correctresponse = (57)
</trial>

<block FUCK>
/trials = [1 = 1; 2 = 2]
</block>


<item connecting>
/1 = "Now you will begin the main experiment.

Press space to search for another Prolific Academic user."
</item>

<text connecting>
/fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/txcolor = (black)
/items = connecting
</text>

<trial connecting>
/stimulustimes = [1 = connecting]
/correctresponse = (57)
/branch = [trial.waiting]
</trial>

-----

<video clock>
/items = ("libet0.avi")
/playthrough = false
/loop = true
/size = (20%, 20%)
</video>

<item waiting>
/1 = "Please wait while we connect you to another user..."
</item>

<text waiting>
/fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/txcolor = (black)
/items = waiting
/position = (50, 80)
</text>

<trial waiting>
/stimulustimes = [1 = clock, waiting]
/timeout = 1000
</trial>

-----

<item connecting2>
/1 = "You are now connected with another Prolific Academic user!

Press the space bar to continue."
</item>

<text connecting2>
/fontstyle = ("Arial", 3.00%, false, false, false, false, 5, 1)
/txcolor = (black)
/items = connecting2
</text>

<trial connecting2>
/stimulustimes = [1 = connecting2]
/correctresponse = (57)
</trial>

-----

<block connecting>
/trials = [1 = connecting; 2 = waiting; 3 = connecting2]
</block>

Many thanks,
Josh
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: 13K, Visits: 104K
Psych_Josh - Tuesday, April 18, 2017
Dear Inquisit forum, I have a slight issue based on conditional branching - effectively I need one trial to branch to another trial based on a valid response within specific latencies. The participant will see a countdown, followed by a stimulus once the countdown finishes. If the participant responds within 150ms either side of the stimulus presented (i.e., a total window of 300ms), then the trial needs to branch to one trial. If the participant responds outside of this window, or fails to respond at all, then the trial needs to branch to another. In this instance, the stimulus (BulbL) is presented at 4000ms, so I have tried:

<trial selfcountdownprac500>
/stimulustimes = [1 = middle, PA_Name; 4000 = BulbL; 4100 = whiterectangle2]
/ontrialbegin = [trial.selfcountdownprac500.insertstimulustime(list.countdown_500.nextvalue, 1000)]
/ontrialbegin = [trial.selfcountdownprac500.insertstimulustime(list.countdown_500.nextvalue, 2000)]
/ontrialbegin = [trial.selfcountdownprac500.insertstimulustime(list.countdown_500.nextvalue, 3000)]
/beginresponsetime = 3000
/validresponse = ("q")
/branch = [if(trial.selfcountdownprac500.elapsedtime>3850 && trial.selfcountdownprac500.elapsedtime<4150 && trial.selfcountdownprac500.response == "q") trial.selfprac500 else (trial.selfcountdownprac500.elapsedtime<3850 && trial.selfcountdownprac500.elapsedtime>4150) trial.selfclickprac500error]
/recorddata = false
/timeout = 4200
</trial>

However, this is simply not working, and not branching at all (i.e., it begins the trial again). I also need the trial to not advance to the next trial immediately; i.e., register the response, but not advance to the next trial on registering the response (hence the timeout). I realise I am probably making a fatal error somewhere, and may not even involve what I have attempted here, as I am not adept at using conditional logic, so any assistance would be greatly appreciated. There might be a very simple solution, as a part of me feels that I have overcomplicated this procedure in my head.

Many thanks,
Josh


A <trial>'s response property returns the numerical keyboard scancode (see Tools -> Keyboard Scancodes...), not "q". Hence

trial.selfcountdownprac500.response == "q"

will not work.

Moreover,

(trial.selfcountdownprac500.elapsedtime<3850 && trial.selfcountdownprac500.elapsedtime>4150)

makes no sense as a condition. The elapsed time cannot be BOTH smaller than 3850 AND greater than 4150 at the same time, i..e the logical AND (&&) makes no sense here.

In sum, I'd rephrase the /branch a something along the lines of

/branch = [if(trial.selfcountdownprac500.latency>=850 && trial.selfcountdownprac500.latency<=1150 && trial.selfcountdownprac500.response == 16) trial.selfprac500 else  trial.selfclickprac500error]

Side note: The "Q" key is potentially a bad choice. It inhabits different positions on different-language keyboards, and thus will have different scancodes associated with it across languages: The scancode will be 16 on the English QWERTY layout, but not on e.g. a French AZERTY keyboard, where scancode 16 will be associated with the "A" key.. Scancodes reflect physical position of a key on the keyboard, rather than the letter imprinted on it.


Edited 7 Years Ago by Dave
Psych_Josh
Psych_Josh
Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)
Group: Forum Members
Posts: 85, Visits: 397
Dear Inquisit forum, I have a slight issue based on conditional branching - effectively I need one trial to branch to another trial based on a valid response within specific latencies. The participant will see a countdown, followed by a stimulus once the countdown finishes. If the participant responds within 150ms either side of the stimulus presented (i.e., a total window of 300ms), then the trial needs to branch to one trial. If the participant responds outside of this window, or fails to respond at all, then the trial needs to branch to another. In this instance, the stimulus (BulbL) is presented at 4000ms, so I have tried:

<trial selfcountdownprac500>
/stimulustimes = [1 = middle, PA_Name; 4000 = BulbL; 4100 = whiterectangle2]
/ontrialbegin = [trial.selfcountdownprac500.insertstimulustime(list.countdown_500.nextvalue, 1000)]
/ontrialbegin = [trial.selfcountdownprac500.insertstimulustime(list.countdown_500.nextvalue, 2000)]
/ontrialbegin = [trial.selfcountdownprac500.insertstimulustime(list.countdown_500.nextvalue, 3000)]
/beginresponsetime = 3000
/validresponse = ("q")
/branch = [if(trial.selfcountdownprac500.elapsedtime>3850 && trial.selfcountdownprac500.elapsedtime<4150 && trial.selfcountdownprac500.response == "q") trial.selfprac500 else (trial.selfcountdownprac500.elapsedtime<3850 && trial.selfcountdownprac500.elapsedtime>4150) trial.selfclickprac500error]
/recorddata = false
/timeout = 4200
</trial>

However, this is simply not working, and not branching at all (i.e., it begins the trial again). I also need the trial to not advance to the next trial immediately; i.e., register the response, but not advance to the next trial on registering the response (hence the timeout). I realise I am probably making a fatal error somewhere, and may not even involve what I have attempted here, as I am not adept at using conditional logic, so any assistance would be greatly appreciated. There might be a very simple solution, as a part of me feels that I have overcomplicated this procedure in my head.

Many thanks,
Josh


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search