Passing values from one script to another


Author
Message
satchmo496
satchmo496
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 35, Visits: 77
I am designing a set of tasks for Inquisit web that I will run using the batch element.

In the first task, one stimulus from a set of 10 stimuli is randomly selected and then this same stimulus is presented across numerous trials of the study. The stimulus is selected using the following counter element:

<counter targetcounter>
/ select = noreplace(1-10)
/ selectionrate = experiment
/ resetinterval = 0
</counter>

I need the second task to also present this same randomly-selected stimulus, which means I need to pass information about which stimulus was selected in the first task to the second task. I’m having trouble figuring out how to do this smoothly. Any guidance would be most appreciated! (Also happy to provide the scripts for the two tasks if it would be helpful).

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
satchmo496 - 12/4/2024
I am designing a set of tasks for Inquisit web that I will run using the batch element.

In the first task, one stimulus from a set of 10 stimuli is randomly selected and then this same stimulus is presented across numerous trials of the study. The stimulus is selected using the following counter element:

<counter targetcounter>
/ select = noreplace(1-10)
/ selectionrate = experiment
/ resetinterval = 0
</counter>

I need the second task to also present this same randomly-selected stimulus, which means I need to pass information about which stimulus was selected in the first task to the second task. I’m having trouble figuring out how to do this smoothly. Any guidance would be most appreciated! (Also happy to provide the scripts for the two tasks if it would be helpful).

https://www.millisecond.com/support/docs/v6/html/howto/batchparameters.htm
satchmo496
satchmo496
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 35, Visits: 77
Dave - 12/4/2024
satchmo496 - 12/4/2024
I am designing a set of tasks for Inquisit web that I will run using the batch element.

In the first task, one stimulus from a set of 10 stimuli is randomly selected and then this same stimulus is presented across numerous trials of the study. The stimulus is selected using the following counter element:

<counter targetcounter>
/ select = noreplace(1-10)
/ selectionrate = experiment
/ resetinterval = 0
</counter>

I need the second task to also present this same randomly-selected stimulus, which means I need to pass information about which stimulus was selected in the first task to the second task. I’m having trouble figuring out how to do this smoothly. Any guidance would be most appreciated! (Also happy to provide the scripts for the two tasks if it would be helpful).

https://www.millisecond.com/support/docs/v6/html/howto/batchparameters.htm

I did consult this support article already but unfortunately, I'm unable to get things to work properly. The problem I'm running into is that I am selecting one from ten pictures as stimuli in the first script. The selected picture (or, at least, the number of the selected picture in the list) then needs to get passed to the second script. I've been easily able to pass numeric parameters in previous batch scripts I've constructed, but the added wrinkle of this being a picture that needs to get passed is tripping me up. It's almost certain that, given my limited programming experience, I am just making a simple error here. I'm attaching the scripts in case you are able to look them over and suggest a path forward. Thank you and, again, apologies for what I'm almost certain is a simple fix for someone who is more familiar with programming languages!
Attachments
Files.zip (28 views, 10.00 KB)
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
satchmo496 - 12/5/2024
Dave - 12/4/2024
satchmo496 - 12/4/2024
I am designing a set of tasks for Inquisit web that I will run using the batch element.

In the first task, one stimulus from a set of 10 stimuli is randomly selected and then this same stimulus is presented across numerous trials of the study. The stimulus is selected using the following counter element:

<counter targetcounter>
/ select = noreplace(1-10)
/ selectionrate = experiment
/ resetinterval = 0
</counter>

I need the second task to also present this same randomly-selected stimulus, which means I need to pass information about which stimulus was selected in the first task to the second task. I’m having trouble figuring out how to do this smoothly. Any guidance would be most appreciated! (Also happy to provide the scripts for the two tasks if it would be helpful).

https://www.millisecond.com/support/docs/v6/html/howto/batchparameters.htm

I did consult this support article already but unfortunately, I'm unable to get things to work properly. The problem I'm running into is that I am selecting one from ten pictures as stimuli in the first script. The selected picture (or, at least, the number of the selected picture in the list) then needs to get passed to the second script. I've been easily able to pass numeric parameters in previous batch scripts I've constructed, but the added wrinkle of this being a picture that needs to get passed is tripping me up. It's almost certain that, given my limited programming experience, I am just making a simple error here. I'm attaching the scripts in case you are able to look them over and suggest a path forward. Thank you and, again, apologies for what I'm almost certain is a simple fix for someone who is more familiar with programming languages!

You don't need to pass a "picture". You need to pass an item number. That's no different than passing a score from script A to script B. Script A picks an item number, that item number just gets passed to script B in a variable / parameter.

Script B then just needs to *use* that variable / parameter for item selection.

The scripts you provided are of little use, since they can't be run. If you need to provide scripts, please always include any and all files they require to run.

satchmo496
satchmo496
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 35, Visits: 77
Dave - 12/5/2024
satchmo496 - 12/5/2024
Dave - 12/4/2024
satchmo496 - 12/4/2024
I am designing a set of tasks for Inquisit web that I will run using the batch element.

In the first task, one stimulus from a set of 10 stimuli is randomly selected and then this same stimulus is presented across numerous trials of the study. The stimulus is selected using the following counter element:

<counter targetcounter>
/ select = noreplace(1-10)
/ selectionrate = experiment
/ resetinterval = 0
</counter>

I need the second task to also present this same randomly-selected stimulus, which means I need to pass information about which stimulus was selected in the first task to the second task. I’m having trouble figuring out how to do this smoothly. Any guidance would be most appreciated! (Also happy to provide the scripts for the two tasks if it would be helpful).

https://www.millisecond.com/support/docs/v6/html/howto/batchparameters.htm

I did consult this support article already but unfortunately, I'm unable to get things to work properly. The problem I'm running into is that I am selecting one from ten pictures as stimuli in the first script. The selected picture (or, at least, the number of the selected picture in the list) then needs to get passed to the second script. I've been easily able to pass numeric parameters in previous batch scripts I've constructed, but the added wrinkle of this being a picture that needs to get passed is tripping me up. It's almost certain that, given my limited programming experience, I am just making a simple error here. I'm attaching the scripts in case you are able to look them over and suggest a path forward. Thank you and, again, apologies for what I'm almost certain is a simple fix for someone who is more familiar with programming languages!

You don't need to pass a "picture". You need to pass an item number. That's no different than passing a score from script A to script B. Script A picks an item number, that item number just gets passed to script B in a variable / parameter.

Script B then just needs to *use* that variable / parameter for item selection.

The scripts you provided are of little use, since they can't be run. If you need to provide scripts, please always include any and all files they require to run.

Apologies for not including all the files. Rookie mistake.

I understand that the item number is what need to gets passed, but I'm having trouble figuring out how to pass it to the correct element in the second script. I'm unable to provide the full materials in a zip folder because I'm told it will put me over my size limit, but here is a link to the materials. But here are the parts that I think are most important as well:

Here's the code from the Batch file:

<parameters>
/ target_character = 0
</parameters>

<values>
/ target_character_mere_exposure = 0
</values>

<batch mere_exposure>
/ file = "Mere Exposure 30 vs. 0 exposures v1.iqx"
/ file = "SCIAT 30 vs. 0 exposures v1.iqx"
/ onscriptend = [
    if(batch.mere_exposure.currentscript == "Mere Exposure 30 vs. 0 exposures v1.iqx")
    {
        parameters.target_character = values.target_character_mere_exposure
    }]
</batch>

In the "Mere Exposure 30 vs. 0 exposures" file I have this code:

<values>
/ target_character_mere_exposure = 0
</values>

<trial target_arrowleft>
/ pretrialpause = 1500
/ validresponse = ("I", "E")
/ correctresponse = ("E")
/ stimulustimes = [1=fixation; 801=forwardmask; 831=target; 846=backwardmask; 876=blank; 877=leftarrow]
/ ontrialend = [item.presentedtarget.appenditem(picture.target.currentitem);]
/ ontrialend = [
    values.target_character_mere_exposure = picture.target.currentitemnumber
]
</trial>

And then, in the SCIAT file I have this code:

<parameters>
/ target_character = 0
</parameters>

<values>
/ target_character_iat = 0
</values>

<expt a>
/ onexptbegin = [
    values.conditionOrder = "c-ic";
]
/ onexptbegin = [
    values.target_character_iat = parameters.target_character;
]
/ preinstructions = (iatintro)
/groups = (1 of 2)
/ blocks = [
    1=practice_compatibletest;
    2=compatibletestinstructions;
    3=compatibletest;
    4=practice_incompatibletest;
    5=incompatibletestinstructions;
    6=incompatibletest;
    7=summary;
]
</expt>


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
satchmo496 - 12/5/2024
Dave - 12/5/2024
satchmo496 - 12/5/2024
Dave - 12/4/2024
satchmo496 - 12/4/2024
I am designing a set of tasks for Inquisit web that I will run using the batch element.

In the first task, one stimulus from a set of 10 stimuli is randomly selected and then this same stimulus is presented across numerous trials of the study. The stimulus is selected using the following counter element:

<counter targetcounter>
/ select = noreplace(1-10)
/ selectionrate = experiment
/ resetinterval = 0
</counter>

I need the second task to also present this same randomly-selected stimulus, which means I need to pass information about which stimulus was selected in the first task to the second task. I’m having trouble figuring out how to do this smoothly. Any guidance would be most appreciated! (Also happy to provide the scripts for the two tasks if it would be helpful).

https://www.millisecond.com/support/docs/v6/html/howto/batchparameters.htm

I did consult this support article already but unfortunately, I'm unable to get things to work properly. The problem I'm running into is that I am selecting one from ten pictures as stimuli in the first script. The selected picture (or, at least, the number of the selected picture in the list) then needs to get passed to the second script. I've been easily able to pass numeric parameters in previous batch scripts I've constructed, but the added wrinkle of this being a picture that needs to get passed is tripping me up. It's almost certain that, given my limited programming experience, I am just making a simple error here. I'm attaching the scripts in case you are able to look them over and suggest a path forward. Thank you and, again, apologies for what I'm almost certain is a simple fix for someone who is more familiar with programming languages!

You don't need to pass a "picture". You need to pass an item number. That's no different than passing a score from script A to script B. Script A picks an item number, that item number just gets passed to script B in a variable / parameter.

Script B then just needs to *use* that variable / parameter for item selection.

The scripts you provided are of little use, since they can't be run. If you need to provide scripts, please always include any and all files they require to run.

Apologies for not including all the files. Rookie mistake.

I understand that the item number is what need to gets passed, but I'm having trouble figuring out how to pass it to the correct element in the second script. I'm unable to provide the full materials in a zip folder because I'm told it will put me over my size limit, but here is a link to the materials. But here are the parts that I think are most important as well:

Here's the code from the Batch file:

<parameters>
/ target_character = 0
</parameters>

<values>
/ target_character_mere_exposure = 0
</values>

<batch mere_exposure>
/ file = "Mere Exposure 30 vs. 0 exposures v1.iqx"
/ file = "SCIAT 30 vs. 0 exposures v1.iqx"
/ onscriptend = [
    if(batch.mere_exposure.currentscript == "Mere Exposure 30 vs. 0 exposures v1.iqx")
    {
        parameters.target_character = values.target_character_mere_exposure
    }]
</batch>

In the "Mere Exposure 30 vs. 0 exposures" file I have this code:

<values>
/ target_character_mere_exposure = 0
</values>

<trial target_arrowleft>
/ pretrialpause = 1500
/ validresponse = ("I", "E")
/ correctresponse = ("E")
/ stimulustimes = [1=fixation; 801=forwardmask; 831=target; 846=backwardmask; 876=blank; 877=leftarrow]
/ ontrialend = [item.presentedtarget.appenditem(picture.target.currentitem);]
/ ontrialend = [
    values.target_character_mere_exposure = picture.target.currentitemnumber
]
</trial>

And then, in the SCIAT file I have this code:

<parameters>
/ target_character = 0
</parameters>

<values>
/ target_character_iat = 0
</values>

<expt a>
/ onexptbegin = [
    values.conditionOrder = "c-ic";
]
/ onexptbegin = [
    values.target_character_iat = parameters.target_character;
]
/ preinstructions = (iatintro)
/groups = (1 of 2)
/ blocks = [
    1=practice_compatibletest;
    2=compatibletestinstructions;
    3=compatibletest;
    4=practice_incompatibletest;
    5=incompatibletestinstructions;
    6=incompatibletest;
    7=summary;
]
</expt>


It's simple:
You pick an item number from a list or counter onexptbegin in the 1st script and store it in a variable. All the stimulus elements use that variable for item selection.
By way of a little batch logic, you then just pass that item number to the 2nd script, via the parameter. All the stimulus elements in the 2nd script use the parameter for item selection.

Attached are the changed files (nothing else). Work through these until you understand how they work together.
Attachments
batch.zip (22 views, 11.00 KB)
Edited 2 Weeks Ago by Dave
satchmo496
satchmo496
Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)Expert (1.2K reputation)
Group: Forum Members
Posts: 35, Visits: 77
Dave - 12/5/2024
satchmo496 - 12/5/2024
Dave - 12/5/2024
satchmo496 - 12/5/2024
Dave - 12/4/2024
satchmo496 - 12/4/2024
I am designing a set of tasks for Inquisit web that I will run using the batch element.

In the first task, one stimulus from a set of 10 stimuli is randomly selected and then this same stimulus is presented across numerous trials of the study. The stimulus is selected using the following counter element:

<counter targetcounter>
/ select = noreplace(1-10)
/ selectionrate = experiment
/ resetinterval = 0
</counter>

I need the second task to also present this same randomly-selected stimulus, which means I need to pass information about which stimulus was selected in the first task to the second task. I’m having trouble figuring out how to do this smoothly. Any guidance would be most appreciated! (Also happy to provide the scripts for the two tasks if it would be helpful).

https://www.millisecond.com/support/docs/v6/html/howto/batchparameters.htm

I did consult this support article already but unfortunately, I'm unable to get things to work properly. The problem I'm running into is that I am selecting one from ten pictures as stimuli in the first script. The selected picture (or, at least, the number of the selected picture in the list) then needs to get passed to the second script. I've been easily able to pass numeric parameters in previous batch scripts I've constructed, but the added wrinkle of this being a picture that needs to get passed is tripping me up. It's almost certain that, given my limited programming experience, I am just making a simple error here. I'm attaching the scripts in case you are able to look them over and suggest a path forward. Thank you and, again, apologies for what I'm almost certain is a simple fix for someone who is more familiar with programming languages!

You don't need to pass a "picture". You need to pass an item number. That's no different than passing a score from script A to script B. Script A picks an item number, that item number just gets passed to script B in a variable / parameter.

Script B then just needs to *use* that variable / parameter for item selection.

The scripts you provided are of little use, since they can't be run. If you need to provide scripts, please always include any and all files they require to run.

Apologies for not including all the files. Rookie mistake.

I understand that the item number is what need to gets passed, but I'm having trouble figuring out how to pass it to the correct element in the second script. I'm unable to provide the full materials in a zip folder because I'm told it will put me over my size limit, but here is a link to the materials. But here are the parts that I think are most important as well:

Here's the code from the Batch file:

<parameters>
/ target_character = 0
</parameters>

<values>
/ target_character_mere_exposure = 0
</values>

<batch mere_exposure>
/ file = "Mere Exposure 30 vs. 0 exposures v1.iqx"
/ file = "SCIAT 30 vs. 0 exposures v1.iqx"
/ onscriptend = [
    if(batch.mere_exposure.currentscript == "Mere Exposure 30 vs. 0 exposures v1.iqx")
    {
        parameters.target_character = values.target_character_mere_exposure
    }]
</batch>

In the "Mere Exposure 30 vs. 0 exposures" file I have this code:

<values>
/ target_character_mere_exposure = 0
</values>

<trial target_arrowleft>
/ pretrialpause = 1500
/ validresponse = ("I", "E")
/ correctresponse = ("E")
/ stimulustimes = [1=fixation; 801=forwardmask; 831=target; 846=backwardmask; 876=blank; 877=leftarrow]
/ ontrialend = [item.presentedtarget.appenditem(picture.target.currentitem);]
/ ontrialend = [
    values.target_character_mere_exposure = picture.target.currentitemnumber
]
</trial>

And then, in the SCIAT file I have this code:

<parameters>
/ target_character = 0
</parameters>

<values>
/ target_character_iat = 0
</values>

<expt a>
/ onexptbegin = [
    values.conditionOrder = "c-ic";
]
/ onexptbegin = [
    values.target_character_iat = parameters.target_character;
]
/ preinstructions = (iatintro)
/groups = (1 of 2)
/ blocks = [
    1=practice_compatibletest;
    2=compatibletestinstructions;
    3=compatibletest;
    4=practice_incompatibletest;
    5=incompatibletestinstructions;
    6=incompatibletest;
    7=summary;
]
</expt>


It's simple:
You pick an item number from a list or counter onexptbegin in the first script and store it in a variable. All the stimulus elements use that variable for item selection.
Via the batch logic, you then just pass that item number to the 2nd script, via the parameter. All the stimulus elements in the 2nd scrpt use the parameter for item selection.

Attached are the changed files (nothing else). Work through these until you understand how they work together.

Terrific! Thanks much!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search