This is for occasions when you want a command to access a different scope. A couple of examples I have come across:
A shop inventory. I want the player to be able to type BUY BREAD, and Quest will look though the shop inventory object for the bread object.
A spell book. I want the player to be able to type CAST UNLOCK, and Quest will look though the spell book object for the unlock object.
The function is called ProcessScopeCommand and takes these parameters
script: A string that gives the name of the script to call on the object
scope: An object list from which to get objects
text: The text variable from command
noobject: A string to display if no object is found
noscript: A string to display if the object is found, but it does not have the named script
Here it is in action for the second example ("castspell" is the name of a script that must be present on each spell item, and gets invoked when a spell is cast):
<command name="Cast">
<pattern>cast #text#</pattern>
<script>
ProcessScopeCommand ("castspell", GetDirectChildren (spellbook), text, "No such spell in your book", "That's not a spell; it should not even be in your book")
</script>
</command>
Here is an example (you will also need Jay's InvPane2 library file to get it to work):
Note that this cannot handle multiple objects in one command.