Millisecond Forums

Flashing background at random times

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

By Dragos - 6/17/2020

I am trying to modify the Bart script(found at https://www.millisecond.com/download/library/bart/) by having the screen flash red in the init trial. I would like this to happen randomly only in let's say 20 of the 30 times the trial runs. Question is how does one make it so that it does not flash every time, rather a set number of times, and not necessarily all in a row as well? What I have added so far is a simple background shape which flashes in /ontrialbegin in the init trial
By Dave - 6/17/2020

Dragos - 6/17/2020
I am trying to modify the Bart script(found at https://www.millisecond.com/download/library/bart/) by having the screen flash red in the init trial. I would like this to happen randomly only in let's say 20 of the 30 times the trial runs. Question is how does one make it so that it does not flash every time, rather a set number of times, and not necessarily all in a row as well? What I have added so far is a simple background shape which flashes in /ontrialbegin in the init trial

Set up a <list> containing, say, 10 x the value 0 (indicating no flash) and 20 x the value 1 (indicating flash). Sample a value from the list ontrialbegin and store it in a <values> entry. Then insert the flashing shape(s) conditionally /ontrialbegin (if the sample value is 1, insert else do nothing), and /ontrialend perform trial.init.resetstimulusframes().
By Dave - 6/17/2020

Dave - 6/17/2020
Dragos - 6/17/2020
I am trying to modify the Bart script(found at https://www.millisecond.com/download/library/bart/) by having the screen flash red in the init trial. I would like this to happen randomly only in let's say 20 of the 30 times the trial runs. Question is how does one make it so that it does not flash every time, rather a set number of times, and not necessarily all in a row as well? What I have added so far is a simple background shape which flashes in /ontrialbegin in the init trial

Set up a <list> containing, say, 10 x the value 0 (indicating no flash) and 20 x the value 1 (indicating flash). Sample a value from the list ontrialbegin and store it in a <values> entry. Then insert the flashing shape(s) conditionally /ontrialbegin (if the sample value is 1, insert else do nothing), and /ontrialend perform trial.init.resetstimulusframes().

Quick example modification attached below. This should give you the general idea.
By Dragos - 6/17/2020

Dave - 6/17/2020
Sample a value from the list ontrialbegin and store it in a <values> entry.

How should I sample at random from the list? I Have added as per your advice the following:


<list flashing>
/ items = (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0)
/ replace = false
</list>

<values>
/ flashing = 0
</values>

<trial init>
/ ontrialbegin = [
    ...
    values.flashing = list.flashing.?
    ...
]

Also, what do you mean by inserting the shapes? Changing the color from white to red?
By Dave - 6/17/2020

Dragos - 6/17/2020
Dave - 6/17/2020
Sample a value from the list ontrialbegin and store it in a <values> entry.

How should I sample at random from the list? I Have added as per your advice the following:


<list flashing>
/ items = (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0)
/ replace = false
</list>

<values>
/ flashing = 0
</values>

<trial init>
/ ontrialbegin = [
    ...
    values.flashing = list.flashing.?
    ...
]

Also, what do you mean by inserting the shapes? Changing the color from white to red?

See the script attached to my previous reply.