A tester typed, >Sure thing, honey, and he got the msg [Runtime error: nil object reference]
(None of these words are used in the game)
When I do this in the debugger, the game drops into Parser.t with a yellow pointer to the line below which reads:
if (ret.length() == 0)
results.noVocabMatch(resolver.getAction(), getOrigText());
More generally, any time two unknown words are entered, separate by a comma, this bug occurs. For example:
abcde, fghij
will produce the error as well.
The code below is from parser.t, and can be found under:
class NounPhraseWithVocab: NounPhraseProd
resolveNounsMatchName(results, resolver, matchList)
{
local origTokens;
local adjustedTokens;
local objVec;
local ret;
/* get the original token list for the command */
origTokens = getOrigTokenList();
/* get the adjusted token list for the command */
adjustedTokens = getAdjustedTokens();
/* set up to receive about the same number of results as inputs */
objVec = new Vector(matchList.length());
/* consider each preliminary match */
foreach (local cur in matchList)
{
/* ask this object if it wants to be included */
local newObj = resolver.matchName(
cur.obj_, origTokens, adjustedTokens);
/* check the result */
if (newObj == nil)
{
/*
* it's nil - this means it's not a match for the name
* after all, so leave it out of the results
*/
}
else if (newObj.ofKind(Collection))
{
/*
* it's a collection of some kind - add each element to
* the result list, using the same flags as the original
*/
foreach (local curObj in newObj)
objVec.append(new ResolveInfo(curObj, cur.flags_, self));
}
else
{
/*
* it's a single object - add it ito the result list,
* using the same flags as the original
*/
objVec.append(new ResolveInfo(newObj, cur.flags_, self));
}
}
/* convert the result vector to a list */
ret = objVec.toList();
/* if our list is empty, note it in the results */
if (ret.length() == 0)
{
/*
* If the adjusted token list contains any tokens of type
* "miscWord", send the phrase to the results object for
* further consideration.
*/
if (adjustedTokens.indexOf(&miscWord) != nil)
{
/*
* we have miscWord tokens, so this is a miscWordList
* match - let the results object process it specially.
*/
ret = results.unknownNounPhrase(self, resolver);
}
/*
* if the list is empty, note that we have a noun phrase
* whose vocabulary words don't match anything in the game
*/
if (ret.length() == 0)
results.noVocabMatch(resolver.getAction(), getOrigText());
}
Any suggestions?
Thanks,
âBob