# Scope="local" generating many events

**URL:** <https://mworks.discourse.group/t/scope-local-generating-many-events/206>\
**Category:** Support\
**Created:** [January 22, 2020, 2:57pm UTC](https://mworks.discourse.group/t/scope-local-generating-many-events/206 "2020-01-22T14:57:47Z")\
**Posts on this page:** 5\
**Page:** 1

<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:** [January 22, 2020, 2:57pm UTC](https://mworks.discourse.group/t/scope-local-generating-many-events/206/1 "2020-01-22T14:57:47Z")

</div>

Hi Chris,

In an old XML experiment we have a scope=“local” variable that is unused by the experiment - its name is never referenced except in the declaration below:

```
<variable tag="rrStimulusNumber" scope="local" logging="when_changed" default_value="0" type="integer" persistant="0" groups="Internal"/>

```

However, this variable keeps throwing off events. Below is a screenshot of the event stream from an mwk2 file, formatted in a table. ‘rrStimulusNumber’ as far as I can tell with grep is not mentioned anywhere else in the experiment ever.

thanks,  
Mark

---

<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:** [January 22, 2020, 2:57pm UTC](https://mworks.discourse.group/t/scope-local-generating-many-events/206/2 "2020-01-22T14:57:47Z")

</div>

Attachment: [PastedGraphic-1.png](https://mworks.discourse.group/uploads/short-url/6YegH5QMreCvjO5f5aNlHpyMtS7.png) (88.1 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:** [January 22, 2020, 3:40pm UTC](https://mworks.discourse.group/t/scope-local-generating-many-events/206/3 "2020-01-22T15:40:09Z")

</div>

Hi Mark,

MWorks announces local variable values upon entry to most paradigm components (blocks, trials, task systems, etc.). The reason for this (I think) is that each of these components hosts its own local variable “environment”, in which every local variable can have a different value than it does in a different environment, so MWorks tries to keep the event stream up-to-date with the current values of local variables by announcing them.

In your case, even though `rrStimulusNumber` is not being assigned, it _is_ being announced, which is why you see it in the event file.

Chris

---

<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:** [January 23, 2020, 1:09am UTC](https://mworks.discourse.group/t/scope-local-generating-many-events/206/4 "2020-01-23T01:09:24Z")

</div>

OK, got it - thank you. I now understand variable scopes and the Trial/Block etc containers a little better.

Mark

---

<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 19, 2022, 8:37pm UTC](https://mworks.discourse.group/t/scope-local-generating-many-events/206/5 "2022-07-19T20:37:03Z")

</div>


