Millisecond Forums

loop

https://forums.millisecond.com/Topic10988.aspx

By beccca - 7/22/2013

In my study the computer flips a coin for the subjects. 


in the beginning they can test this feature as often as they want. Therefore I need a loop. i tried to do it as follows:



- First I've created a trial for the coin flip. In this trial is either heads or tail shown for e specific amount of seconds.


- After the coin flip comes a question (radiobuttons) whether the subject would like to test the coin again.


- If the subjects klicks "yes" the coinflip trial should appear again and after the coinflip the question whether or not the subject would like to test the coin again should appear.


both (question and coinflip) are in one block (testcoinflip.


That's where I have a problem.


I tried to do it as follows:


In the <serveypage> I wrote:/ branch = [if(radiobuttons.testAgain.response=="Yes") block.testcoinflip]. But that's where I have a problem. I always get the error message "wrong element type".


I then tried to just use the trial instead of the whole block: / branch = [if(radiobuttons.testAgain.response=="Yes") trial.coinflip] but then I just get back to the trial once and after the trial it does not send me to the radiobuttons. It sends me right to the next block (which is in this case an Iowa Gambling Task).


So I am able to let the subject test the coin again but just once. I would like to let them test the coin as often as they want. But therefore I need to reach the question again which I am not able to.



This post is a little complicated... but I hope you understand my problem. 


Thank you for your ideas on how to solve my problem.



Regards


Rebecca

By Dave - 7/22/2013

In the <serveypage> I wrote:/ branch = [if(radiobuttons.testAgain.response=="Yes") block.testcoinflip]. But that's where I have a problem. I always get the error message "wrong element type".


A <surveypage> is a kind of <trial>. You cannot /branch to a <block> from a <trial>, only to another <trial>. The element you /branch *from* most be of the same type as the element you /branch *to*. I.e. a <block> can /branch to another <block> (or back to itself), a <trial> can /branch to a <trial>.


This means: The /branch needs to reside in your block.

By beccca - 7/22/2013

Perfect!! Thank you so much :)