Flashing background at random times


Author
Message
Dragos
Dragos
New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)
Group: Forum Members
Posts: 2, Visits: 3
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
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: 12K, Visits: 98K
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().

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: 12K, Visits: 98K
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.
Attachments
bart.iqx (210 views, 34.00 KB)
Dragos
Dragos
New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)New Member (25 reputation)
Group: Forum Members
Posts: 2, Visits: 3
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?
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: 12K, Visits: 98K
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.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search