I was using the function plugin from rex until upgrading to R111 from R108.2, after which I noticed a few bugs appearing. As an experiment I switched over to the official function plugin but noticed the same behaviour.
The issue seems to be that if I select a sprite and then, in that context, perform an action on it, the code inside the function loses context. Previously this was working fine, but now breaks in both the plugin by rex and the official plugin.
For example, in this code the score only registers as 50 (the first box in the layout), despite there being a second box I am clicking on with a score of 100.
<img src="http://i.imgur.com/HNJ5P.png" border="0">
What I'm curious about is, should I indeed have the scope of the calling event? Or is the function separate from the context of where it is called? Is this something that changed post R108.2?
The list of all changes is available in the changelog of each version.
In your case, in r110.2:
ug fix: Function: in some cases the called function would still reference objects picked from the event calling the function. This was not intended; now function events start picking instances from scratch again.
Pass the UID of the sprite as a parameter of your function and as a subevent or other condition of the "on" function definition, pick the sprite by UID.
Develop games in your browser. Powerful, performant & highly capable.
I read the release notes but I think I misunderstood that to mean it was picking objects outside the scope of the calling function (seeing as how I thought the bug it fixed was how it was actually supposed to work). No worries, I'll pass the UID in and repick the object.