When you use the “new” operator to create an object from a prototype, it sets the prototype as a helper of the new object AND copies the prototype’s properties into the new object. But if you directly set one object to be a helper of another (as you’ve done in your second script) you’ll inherit the behavior of the first (helper) script, but not its properties.
A) Why is the second script not inheriting the properties?
There is no inheritance of properties in SenseTalk – each object has its own properties. You can copy properties from one object to another using the “add properties” or “replace properties” commands, or implicitly by using the “new” operator to create an object from a prototype.
B) Is there a way to make the second script itself (without creating a new object inside it) inherit from the prototype?
Properties are not inherited from a helper, only behaviors. But the helper (the prototype) can include a handler (behavior) that provides a value. So, in your first script you could include this handler:
to handle something
return property something of this object
Then you would be able to use “my something” in the second script to access the value returned by the something handler (which in this case would be the value of the first script’s something property).
Note: It’s important to use “property something of this object” in the helper’s script, not “my something” because a helper takes on the identity of the object it’s helping (meaning that “me” and “my” refer to the helped object in that situation).