PDA

View Full Version : getSelectedObjects() errors out on items in bags



arieswind
10-07-2017, 12:29 AM
getSelectedObjects() will throw an error if one of the objects you have selected has been destroyed either by a script or putting it into a bag.

Steps:

Ctrl-select an object
Put object in a bag
Without changing your selection, click a button that calls getSelectedObjects(). You'll get an error

Error in Script(Functionname - guid) function <Functionname>:

There is no additional error message, just this line.

It seems to me that object guids are not removed from the selection group when they are destroyed, and then cause it to fail when you call getSelectedObjects()

arieswind
10-07-2017, 10:10 AM
i also tried using pcall() to trap the error and it didnt work --- it still spits out the same error and aborts without returning a result

Spoonon
10-16-2017, 07:16 AM
Can confirm all of the above.

Player.getSelectedObjects() throws a nondescript error if the player has destroyed an item (if they deleted the object or dropped it into a bag for example) and has not since clicked to deselect or to select anything else.
Clicking a button will not deselect the object, and thus the script will break there if the button attempts to call Player.getSelectedObjects().

Additionally, pcall() cannot be used to catch this error and continue the script. There is no workaround for scripters to use until this issue is fixed.