On pg 70 in the manual about the local variables. I attached a screenshot of the passage im not getting any understanding over. I understand everything else very well about the local variable section though. Is their a more simple way to explain this? Please let me know. Thanks!
Local variables are undefined unless you define them. Then they will only be visible to their respective incoming event. In this way you can use the same local variable in multiple events without worrying about messing up other events.
The statement you see, explains that you can actually have two translators that have the same incoming event. In this case, you can share the local variable between these two translators. The local variable is not local to the translator, but actually the incoming event.
So if you have two translators monitoring the same event and the first one sets the value of pp to 5, The value will still be 5 when it reaches the second translator (unless otherwise modified).
Once a given incoming event has been process the value goes back to an undefined value.
Personally, I try to avoid sharing local variable between translators however there can be situations where you can find it useful. Once in a while I get tripped up by this when troubleshooting a MT Pro project.
The important thing to remember is that if you don’t initialize a local variable, it will NOT be 0, (like a global variable). It will be undefined.
The other thing is that once the event is over, the variable is no longer kept (valid).
In contrast, global variables last until the project is closed and are always initialized to 0 and project open. If you want the to be something else at project open, then you need to create a translator and rules to do this. I typically create an INIT timer at project open through a translator and then have a timer incoming event with rules that initialize all my global variable in one place. In this way I can also document the global variables I’m using within the project so I know what others I can define when I want to expand the project further.