+xHello,
I am trying to add the number of the block (block_number) as value so after the block 9 and 18 the trial branch with another trial.
The counter goes back to 0 so I cannot trigger the trial that I wanted at the end of the blocks.
Any help?
Thank you so much,
Elena
> The counter goes back to 0 so I cannot trigger the trial that I wanted at the end of the blocks.
What makes you think the counter goes back to zero? I see nothing in the script that would reset values.block_number back to zero.
I do, however, see mistakes in your /branch attributes:
/ branch = [if (values.block_number = 18 ...) ...]
will not work because you are using the wrong operator. If you want to know whether the statement "values.block_number is equal to 18" is *true*, you need to use "==", the logical operator. "=" is the *assignment* operator, i.e., "the variable block_number shall now represent the number X". Thus:
/ branch = [if (values.block_number == 18 ...) ...]
is the correct syntax.
Also, code like this
/ branch = [if (...)
{trial.stocksold_win_pt2; trial.end_pt2_win}]
does not make sense. You cannot /branch to *two* trials at once. You need to /branch to trial.stocksold_win_pt2. Then, *from* <trial stocksold_win_pt2> you need to /branch to trial.end_pt2_win.
Hope this helps.