# Updating trigger\_flag in an array for a fixation point stimulus group

**URL:** <https://mworks.discourse.group/t/updating-trigger-flag-in-an-array-for-a-fixation-point-stimulus-group/1010>\
**Category:** Support\
**Created:** [July 2, 2024, 5:10pm UTC](https://mworks.discourse.group/t/updating-trigger-flag-in-an-array-for-a-fixation-point-stimulus-group/1010 "2024-07-02T17:10:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hokysung](https://avatars.discourse-cdn.com/v4/letter/h/ac8455/32.png) [@hokysung](https://mworks.discourse.group/u/hokysung)\
**Post date:** [July 2, 2024, 5:10pm UTC](https://mworks.discourse.group/t/updating-trigger-flag-in-an-array-for-a-fixation-point-stimulus-group/1010/1 "2024-07-02T17:10:23Z")

</div>

Hi,

I’ve been working on implementing a functionality where multiple occluders are present, and fixation on one of the occluders for a set amount of time will remove the occluder.

I am using a stimulus\_group of fixation\_point stimuli as square occluders, and setting trigger\_flag = onFixOccluders[${local\_index}] for each occluder so that fixation on one of the occluders will update the relevant entry signaling fixation. However, it seems that the trigger does not work properly. I’ve searched around and it seems writing to a variable will only work if I give a variable name, and so a particular entry of a list won’t be writable – is this correct? If so, what do you think is the best way to setup something like this where I have multiple occluder fixation points and want to keep track of whether each of the occluders are being fixated on separately? I might have to change around the number of occluders so ideally it does not require manually defining a new fixation-tracking variable for each occluder, but I’m not sure if there’s a better way.

Here is the stimulus group definition in case it helps:

```auto
stimulus_group occluders {
    range_replicator (
        variable = local_index
        from = 0
        to = nOccluders - 1
        step = 1
        ) {

        stimulus/fixation_point occluder${local_index}(
            color = occluder_red, occluder_green, occluder_blue
            trigger_watch_x = eye_x
            trigger_watch_y = eye_y
            trigger_width = occluderSize
            trigger_flag = onFixOccluders[${local_index}]
            x_size = occluderSize
            y_size = occluderSize
            x_position = occludersX[${local_index}]
            y_position = occludersY[${local_index}]
            rotation = 0
            alpha_multiplier = occluder_alpha
            )

```

```
}

```

}

As always, thank you for your help!

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 3, 2024, 1:23pm UTC](https://mworks.discourse.group/t/updating-trigger-flag-in-an-array-for-a-fixation-point-stimulus-group/1010/2 "2024-07-03T13:23:30Z")

</div>

Hi Hokyung,

> I’ve searched around and it seems writing to a variable will only work if I give a variable name, and so a particular entry of a list won’t be writable – is this correct?

Yes, that’s correct. Changing this is [on my to-do list](https://github.com/mworks/mworks-issues/issues/453), but it’s a non-trivial project, and I’m not sure when I’ll get to it.

> If so, what do you think is the best way to setup something like this where I have multiple occluder fixation points and want to keep track of whether each of the occluders are being fixated on separately? I might have to change around the number of occluders so ideally it does not require manually defining a new fixation-tracking variable for each occluder, but I’m not sure if there’s a better way.

Unfortunately, I think defining a new fixation-tracking variable for each occluder is your only option. But you can still define the occluders using a range replicator and, with a little extra work, keep `onFixOccluders` updated with the current fixation state of all occluders. Please see the attached example.

Cheers,  
Chris  
[occluders.mwel](https://mworks.discourse.group/uploads/short-url/vpB9gfXz8E4ad8NJkuxDXsgJXym.mwel) (1.7 KB)

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 16, 2024, 1:33pm UTC](https://mworks.discourse.group/t/updating-trigger-flag-in-an-array-for-a-fixation-point-stimulus-group/1010/3 "2024-07-16T13:33:18Z")

</div>


