The reason for the error is that you’re checking for “of the noun
” in these lines:
now id entry is the id entry of the noun;
now phrase entry is the phrase entry of the noun;
now response entry is the response entry of the noun;
now unlocks entry is the unlocks entry of the noun;
But at that point, we’re in the context of Carry out talking to
, which means that the noun
is Dirk himself, not his dialog table.
To fix this, the following seems to work:
now id entry is the id in row N of the dialog of the noun;
now phrase entry is the phrase in row N of the dialog of the noun;
now response entry is the response in row N of the dialog of the noun;
now unlocks entry is "blank";
if there is an unlocks in row N of the dialog of the noun:
now unlocks entry is the unlocks in row N of the dialog of the noun;
Note that we also simply say “the id in row N
” etc., not “the id entry in row N
”, and that we have to take special care because of the blank entries (in the unlocks column), otherwise it can lead to runtime errors.
For some conversation-related table handling code, you could also take a look at the “Sweeney” example in chapter “7.8 Saying Complicated Things” in the Recipe Book.
By the way, I’m not completely sure whether you really need to copy the table. Depends of course on the details of the system you’re planning to implement.
In general, you might also want to take a look at some extensions which make it fairly easy to have menu-based conversations: There are Michael Martin’s Reactable Quips and Quip-Based Conversation, and there’s also the excellent “Hybrid Choices” by AW Freyr.