Unable to create logic between blocks


Author
Message
cccyyy
cccyyy
Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)
Group: Forum Members
Posts: 7, Visits: 12
Dave - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
<block socialcomplete1>
/preinstructions = (socialinstruct1, socialinstruct2, socialinstruct3, socialinstruct4, socialinstruct5, instruct5)
/trials = [1-12 = noreplace(S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/postinstructions = (round1)
</block>

<block socialcomplete2>
/trials = [1-12 = noreplace(S13socialcomplete,
S14socialcomplete,
S15socialcomplete,
S16socialcomplete,
S17socialcomplete,
S18socialcomplete,
S19socialcomplete,
S20socialcomplete,
S21socialcomplete,
S22socialcomplete,
S23socialcomplete,
S24socialcomplete)]
</block>

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]
</block>

I created three blocks named "socialcomplete1" "socialcomplete2" and "socialcompleterep1". Each block has 12 rounds.
Block 1 ("socialcomplete1") is a practice trial. What I want is that the program would end when participants successfully finish two blocks consecutively either in the order of Block 2 ("socialcomplete2") and Block 3("socialcompleterep1"), or Block 3("socialcompleterep1") and Block 2 ("socialcomplete2"). But with the above code, I always obtained very bizarre results. 

I've tried to debug this code for almost a week but no luck so far. Would really appreciate if anyone could help!!!

If your code requires external files to run, as yours does, please always provide all necessary files.

Sorry about that. I've uploaded all the files into this drive folder. https://drive.google.com/drive/folders/1Ry9FXFsnyEYN8Lkrsv7qvF1Tjn66RmbV?usp=sharing   

The whole program is a little more complicated as it involves four conditions in which participants will be randomly assigned to. But each condition uses the same logic as I mentioned before and this is where I encountered the problem.

The script never actually runs <block socialcompleterep1>, so I'm not sure how the logic in that block element is supposed to do anything at all.
You're right! This is one thing I missed. But the problem still exists after I added the <block socialcompleterep1> 

It looks like this now (I've updated the file in the drive folder also):
<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2; 3=socialcompleterep1]
</expt>

I think there are still problems within each condition as I mentioned at the beginning. Could you also have a look at that? Thank you so much!!!

> But the problem still exists

Please spell out, clearly, what the supposed problem actually is. "Bizarre results" doesn't really tell me anything.

For what it's worth, what I'm guessing you actually want is

<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2]
</expt>

with

<block socialcomplete2>
/trials = [1-12 = noreplace(S13socialcomplete,
S14socialcomplete,
S15socialcomplete,
S16socialcomplete,
S17socialcomplete,
S18socialcomplete,
S19socialcomplete,
S20socialcomplete,
S21socialcomplete,
S22socialcomplete,
S23socialcomplete,
S24socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcompleterep1]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]

</block>

and

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]

</block>

(analogously for the other conditions

Sorry I should have been more clear about my problem. The thing is I tried several times and each time getting different patterns of errors. I've revised the code as you advised, but the problem still persisted. I uploaded the revised script and a dataouput file.

Here's the test result:
block one (practice)
block two (failed some trials)
block three (all 12 trial correct)
block three (all 12 trial correct, ideally the program should end here because we have two correct trials consecutively, but it continued)
block four (failed some trials)
block five (all 12 trial correct and the program ended here).

Also, are you suggesting that I don't need to add socialcompleterep1 into the following code?
<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2]
</expt>

Okay, thanks for the clarification. Two things need to be fixed:

(1) You'll want to use correctcount, not correctstreak.
(2) In your /branch attributes,

/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]

is wrong. You need

/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount < 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]

otherwise the first branch will always be true and you end up in an infinite loop.

Thank you so much for your help dave! The program works smoothly right now.

Just another small question. I was trying to display a html page before participants are redirected to another block. But it looks like I'm using the wrong code. Do you have any ideas on how I could do that? 

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount < 24) {display.htmlpage round2more; block.socialcomplete2}]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]
</block>
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: 105K
cccyyy - 10/5/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
<block socialcomplete1>
/preinstructions = (socialinstruct1, socialinstruct2, socialinstruct3, socialinstruct4, socialinstruct5, instruct5)
/trials = [1-12 = noreplace(S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/postinstructions = (round1)
</block>

<block socialcomplete2>
/trials = [1-12 = noreplace(S13socialcomplete,
S14socialcomplete,
S15socialcomplete,
S16socialcomplete,
S17socialcomplete,
S18socialcomplete,
S19socialcomplete,
S20socialcomplete,
S21socialcomplete,
S22socialcomplete,
S23socialcomplete,
S24socialcomplete)]
</block>

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]
</block>

I created three blocks named "socialcomplete1" "socialcomplete2" and "socialcompleterep1". Each block has 12 rounds.
Block 1 ("socialcomplete1") is a practice trial. What I want is that the program would end when participants successfully finish two blocks consecutively either in the order of Block 2 ("socialcomplete2") and Block 3("socialcompleterep1"), or Block 3("socialcompleterep1") and Block 2 ("socialcomplete2"). But with the above code, I always obtained very bizarre results. 

I've tried to debug this code for almost a week but no luck so far. Would really appreciate if anyone could help!!!

If your code requires external files to run, as yours does, please always provide all necessary files.

Sorry about that. I've uploaded all the files into this drive folder. https://drive.google.com/drive/folders/1Ry9FXFsnyEYN8Lkrsv7qvF1Tjn66RmbV?usp=sharing   

The whole program is a little more complicated as it involves four conditions in which participants will be randomly assigned to. But each condition uses the same logic as I mentioned before and this is where I encountered the problem.

The script never actually runs <block socialcompleterep1>, so I'm not sure how the logic in that block element is supposed to do anything at all.
You're right! This is one thing I missed. But the problem still exists after I added the <block socialcompleterep1> 

It looks like this now (I've updated the file in the drive folder also):
<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2; 3=socialcompleterep1]
</expt>

I think there are still problems within each condition as I mentioned at the beginning. Could you also have a look at that? Thank you so much!!!

> But the problem still exists

Please spell out, clearly, what the supposed problem actually is. "Bizarre results" doesn't really tell me anything.

For what it's worth, what I'm guessing you actually want is

<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2]
</expt>

with

<block socialcomplete2>
/trials = [1-12 = noreplace(S13socialcomplete,
S14socialcomplete,
S15socialcomplete,
S16socialcomplete,
S17socialcomplete,
S18socialcomplete,
S19socialcomplete,
S20socialcomplete,
S21socialcomplete,
S22socialcomplete,
S23socialcomplete,
S24socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcompleterep1]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]

</block>

and

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]

</block>

(analogously for the other conditions

Sorry I should have been more clear about my problem. The thing is I tried several times and each time getting different patterns of errors. I've revised the code as you advised, but the problem still persisted. I uploaded the revised script and a dataouput file.

Here's the test result:
block one (practice)
block two (failed some trials)
block three (all 12 trial correct)
block three (all 12 trial correct, ideally the program should end here because we have two correct trials consecutively, but it continued)
block four (failed some trials)
block five (all 12 trial correct and the program ended here).

Also, are you suggesting that I don't need to add socialcompleterep1 into the following code?
<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2]
</expt>

Okay, thanks for the clarification. Two things need to be fixed:

(1) You'll want to use correctcount, not correctstreak.
(2) In your /branch attributes,

/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]

is wrong. You need

/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount < 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]

otherwise the first branch will always be true and you end up in an infinite loop.

Thank you so much for your help dave! The program works smoothly right now.

Just another small question. I was trying to display a html page before participants are redirected to another block. But it looks like I'm using the wrong code. Do you have any ideas on how I could do that? 

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount < 24) {display.htmlpage round2more; block.socialcomplete2}]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]
</block>

An instruction page isn't a block, you cannot branch to an instruction page, and you cannot branch to two things at once either.

You need to branch to a block that displays the instruction page. From that block, then, you need to branch to block.socialcomplete2.
cccyyy
cccyyy
Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)Associate Member (113 reputation)
Group: Forum Members
Posts: 7, Visits: 12
Dave - 10/5/2022
cccyyy - 10/5/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
cccyyy - 10/4/2022
Dave - 10/4/2022
cccyyy - 10/4/2022
<block socialcomplete1>
/preinstructions = (socialinstruct1, socialinstruct2, socialinstruct3, socialinstruct4, socialinstruct5, instruct5)
/trials = [1-12 = noreplace(S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/postinstructions = (round1)
</block>

<block socialcomplete2>
/trials = [1-12 = noreplace(S13socialcomplete,
S14socialcomplete,
S15socialcomplete,
S16socialcomplete,
S17socialcomplete,
S18socialcomplete,
S19socialcomplete,
S20socialcomplete,
S21socialcomplete,
S22socialcomplete,
S23socialcomplete,
S24socialcomplete)]
</block>

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]
</block>

I created three blocks named "socialcomplete1" "socialcomplete2" and "socialcompleterep1". Each block has 12 rounds.
Block 1 ("socialcomplete1") is a practice trial. What I want is that the program would end when participants successfully finish two blocks consecutively either in the order of Block 2 ("socialcomplete2") and Block 3("socialcompleterep1"), or Block 3("socialcompleterep1") and Block 2 ("socialcomplete2"). But with the above code, I always obtained very bizarre results. 

I've tried to debug this code for almost a week but no luck so far. Would really appreciate if anyone could help!!!

If your code requires external files to run, as yours does, please always provide all necessary files.

Sorry about that. I've uploaded all the files into this drive folder. https://drive.google.com/drive/folders/1Ry9FXFsnyEYN8Lkrsv7qvF1Tjn66RmbV?usp=sharing   

The whole program is a little more complicated as it involves four conditions in which participants will be randomly assigned to. But each condition uses the same logic as I mentioned before and this is where I encountered the problem.

The script never actually runs <block socialcompleterep1>, so I'm not sure how the logic in that block element is supposed to do anything at all.
You're right! This is one thing I missed. But the problem still exists after I added the <block socialcompleterep1> 

It looks like this now (I've updated the file in the drive folder also):
<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2; 3=socialcompleterep1]
</expt>

I think there are still problems within each condition as I mentioned at the beginning. Could you also have a look at that? Thank you so much!!!

> But the problem still exists

Please spell out, clearly, what the supposed problem actually is. "Bizarre results" doesn't really tell me anything.

For what it's worth, what I'm guessing you actually want is

<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2]
</expt>

with

<block socialcomplete2>
/trials = [1-12 = noreplace(S13socialcomplete,
S14socialcomplete,
S15socialcomplete,
S16socialcomplete,
S17socialcomplete,
S18socialcomplete,
S19socialcomplete,
S20socialcomplete,
S21socialcomplete,
S22socialcomplete,
S23socialcomplete,
S24socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcompleterep1]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]

</block>

and

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctstreak + block.socialcompleterep1.correctstreak == 24) block.endinstruct]

</block>

(analogously for the other conditions

Sorry I should have been more clear about my problem. The thing is I tried several times and each time getting different patterns of errors. I've revised the code as you advised, but the problem still persisted. I uploaded the revised script and a dataouput file.

Here's the test result:
block one (practice)
block two (failed some trials)
block three (all 12 trial correct)
block three (all 12 trial correct, ideally the program should end here because we have two correct trials consecutively, but it continued)
block four (failed some trials)
block five (all 12 trial correct and the program ended here).

Also, are you suggesting that I don't need to add socialcompleterep1 into the following code?
<expt socialcomplete>
/ groupassignment = random
/ subjects= (1 of 4)
/ blocks = [1=socialcomplete1; 2=socialcomplete2]
</expt>

Okay, thanks for the clarification. Two things need to be fixed:

(1) You'll want to use correctcount, not correctstreak.
(2) In your /branch attributes,

/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount <= 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]

is wrong. You need

/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount < 24) block.socialcomplete2]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]

otherwise the first branch will always be true and you end up in an infinite loop.

Thank you so much for your help dave! The program works smoothly right now.

Just another small question. I was trying to display a html page before participants are redirected to another block. But it looks like I'm using the wrong code. Do you have any ideas on how I could do that? 

<block socialcompleterep1>
/preinstructions = (round2more)
/trials = [1-12 = noreplace (S1socialcomplete,
S2socialcomplete,
S3socialcomplete,
S4socialcomplete,
S5socialcomplete,
S6socialcomplete,
S7socialcomplete,
S8socialcomplete,
S9socialcomplete,
S10socialcomplete,
S11socialcomplete,
S12socialcomplete)]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount < 24) {display.htmlpage round2more; block.socialcomplete2}]
/ branch=[if (block.socialcomplete2.correctcount + block.socialcompleterep1.correctcount == 24) block.endinstruct]
</block>

An instruction page isn't a block, you cannot branch to an instruction page, and you cannot branch to two things at once either.

You need to branch to a block that displays the instruction page. From that block, then, you need to branch to block.socialcomplete2.

Ah I see. Thank you so much Dave! I really appreciated your help and being a great mentor on resolving my problems :)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search