I modified this portion of the code as shown below, but it's still not working correctly. Could you please teach me how to properly make those elements match?
<block block_info_group>
/ onblockbegin = [
values.pic1 = list.sat_pic_group.nextvalue;
values.pic2 = list.sat_pic_group.nextvalue;
values.pic3 = list.sat_pic_group.nextvalue;
values.tag1 = list.sat_tag_group.nextvalue;
values.tag2 = list.sat_tag_group.nextvalue;
values.tag3 = list.sat_tag_group.nextvalue;
values.team = 1;
if (values.team == "1") {values.ownteam = "TEAM RED"; values.rivalteam = "TEAM GREEN"; values.neutralteam = "TEAM BLUE"}
if (values.team == "2") {values.ownteam = "TEAM GREEN"; values.rivalteam = "TEAM BLUE"; values.neutralteam = "TEAM RED"}
if (values.team == "3") {values.ownteam = "TEAM BLUE"; values.rivalteam = "TEAM RED"; values.neutralteam = "TEAM GREEN"}]
/ trials = [1 = Group_Info]
/ recorddata = true
/ onblockend = [
if (text.Tag1_group.currentitem == "TEAM RED"&&text.txt_instr_L_group.currentitem == "TEAM RED"&&values.team == "1") {values.pic1con = "ingroup"; values.tag1name = "your team '<%values.ownteam%>'"};
if (text.Tag2_group.currentitem == "TEAM RED"&&text.txt_instr_M_group.currentitem == "TEAM RED"&&values.team == "1") {values.pic2con = "ingroup"; values.tag2name = "your team '<%values.ownteam%>'"};
if (text.Tag3_group.currentitem == "TEAM RED"&&text.txt_instr_R_group.currentitem == "TEAM RED"&&values.team == "1") {values.pic3con = "ingroup"; values.tag3name = "your team '<%values.ownteam%>'"};
if (text.Tag1_group.currentitem == "TEAM GREEN"&&text.txt_instr_L_group.currentitem == "TEAM GREEN"&&values.team == "1") {values.pic1con = "outgroup"; values.tag1name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag2_group.currentitem == "TEAM GREEN"&&text.txt_instr_M_group.currentitem == "TEAM GREEN"&&values.team == "1") {values.pic2con = "outgroup"; values.tag2name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag3_group.currentitem == "TEAM GREEN"&&text.txt_instr_R_group.currentitem == "TEAM GREEN"&&values.team == "1") {values.pic3con = "outgroup"; values.tag3name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag1_group.currentitem == "TEAM BLUE"&&text.txt_instr_L_group.currentitem == "TEAM BLUE"&&values.team == "1") {values.pic1con = "neutral"; values.tag1name = "the non-rival team '<%values.neutralteam%>'"};
if (text.Tag2_group.currentitem == "TEAM BLUE"&&text.txt_instr_M_group.currentitem == "TEAM BLUE"&&values.team == "1") {values.pic2con = "neutral"; values.tag2name = "the non-rival team '<%values.neutralteam%>'"};
if (text.Tag3_group.currentitem == "TEAM BLUE"&&text.txt_instr_R_group.currentitem == "TEAM BLUE"&&values.team == "1") {values.pic3con = "neutral"; values.tag3name = "the non-rival team '<%values.neutralteam%>'"};
if (text.Tag1_group.currentitem == "TEAM GREEN"&&text.txt_instr_L_group.currentitem == "TEAM GREEN"&&values.team == "2") {values.pic1con = "ingroup"; values.tag1name = "your team '<%values.ownteam%>'"};
if (text.Tag2_group.currentitem == "TEAM GREEN"&&text.txt_instr_M_group.currentitem == "TEAM GREEN"&&values.team == "2") {values.pic2con = "ingroup"; values.tag2name = "your team '<%values.ownteam%>'"};
if (text.Tag3_group.currentitem == "TEAM GREEN"&&text.txt_instr_R_group.currentitem == "TEAM GREEN"&&values.team == "2") {values.pic3con = "ingroup"; values.tag3name = "your team '<%values.ownteam%>'"};
if (text.Tag1_group.currentitem == "TEAM BLUE"&&text.txt_instr_L_group.currentitem == "TEAM BLUE"&&values.team == "2") {values.pic1con = "outgroup"; values.tag1name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag2_group.currentitem == "TEAM BLUE"&&text.txt_instr_M_group.currentitem == "TEAM BLUE"&&values.team == "2") {values.pic2con = "outgroup"; values.tag2name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag3_group.currentitem == "TEAM BLUE"&&text.txt_instr_R_group.currentitem == "TEAM BLUE"&&values.team == "2") {values.pic3con = "outgroup"; values.tag3name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag1_group.currentitem == "TEAM RED"&&text.txt_instr_L_group.currentitem == "TEAM RED"&&values.team == "2") {values.pic1con = "neutral"; values.tag1name = "the non-rival team '<%values.neutralteam%>'"};
if (text.Tag2_group.currentitem == "TEAM RED"&&text.txt_instr_M_group.currentitem == "TEAM RED"&&values.team == "2") {values.pic2con = "neutral"; values.tag2name = "the non-rival team '<%values.neutralteam%>'"};
if (text.Tag3_group.currentitem == "TEAM RED"&&text.txt_instr_R_group.currentitem == "TEAM RED"&&values.team == "2") {values.pic3con = "neutral"; values.tag3name = "the non-rival team '<%values.neutralteam%>'"};
if (text.Tag1_group.currentitem == "TEAM BLUE"&&text.txt_instr_L_group.currentitem == "TEAM BLUE"&&values.team == "3") {values.pic1con = "ingroup"; values.tag1name = "your team '<%values.ownteam%>'"};
if (text.Tag2_group.currentitem == "TEAM BLUE"&&text.txt_instr_M_group.currentitem == "TEAM BLUE"&&values.team == "3") {values.pic2con = "ingroup"; values.tag2name = "your team '<%values.ownteam%>'"};
if (text.Tag3_group.currentitem == "TEAM BLUE"&&text.txt_instr_R_group.currentitem == "TEAM BLUE"&&values.team == "3") {values.pic3con = "ingroup"; values.tag3name = "your team '<%values.ownteam%>'"};
if (text.Tag1_group.currentitem == "TEAM RED"&&text.txt_instr_L_group.currentitem == "TEAM RED"&&values.team == "3") {values.pic1con = "outgroup"; values.tag1name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag2_group.currentitem == "TEAM RED"&&text.txt_instr_M_group.currentitem == "TEAM RED"&&values.team == "3") {values.pic2con = "outgroup"; values.tag2name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag3_group.currentitem == "TEAM RED"&&text.txt_instr_R_group.currentitem == "TEAM RED"&&values.team == "3") {values.pic3con = "outgroup"; values.tag3name = "the rival team '<%values.rivalteam%>'"};
if (text.Tag1_group.currentitem == "TEAM GREEN"&&text.txt_instr_L_group.currentitem == "TEAM GREEN"&&values.team == "3") {values.pic1con = "neutral"; values.tag1name = "the non-rival team '<%values.neutralteam%>'"};
if (text.Tag2_group.currentitem == "TEAM GREEN"&&text.txt_instr_M_group.currentitem == "TEAM GREEN"&&values.team == "3") {values.pic2con = "neutral"; values.tag2name = "the non-rival team '<%values.neutralteam%>'"};
if (text.Tag3_group.currentitem == "TEAM GREEN"&&text.txt_instr_R_group.currentitem == "TEAM GREEN"&&values.team == "3") {values.pic3con = "neutral"; values.tag3name = "the non-rival team '<%values.neutralteam%>'"};
]
</block>