If the object function is specified more than once within a single response, ESL returns the same value until the response is complete. For example, if your program contains two objects such as the following:
key Help at position 100 0 in Screen1
solid box 100 80
move 50 40
text center "Help"
key Help at position 100 0 in Screen2
solid box 100 80
move 50 40
text center "Help"
you should use the ancestry function to determine which object was selected:
response to HelpKeys
copy object in ancestry to ObjectSelected
make ObjectSelected invisible
...
The object function does not return the ancestry along with the name. In the case where you are using the object function for two objects with the same name, use the ancestry function as well; for example:
copy object in ancestry to CurrentObject