Yes, I’m trying to trace what happens when I run this line:
if the player's command includes "[any sought thing]":
I figure if I can identify what code produces that result, I can modify it to loop over all matching objects. I want to do it for both “includes” and “matches,” and I don’t mind looping over all possible snippets myself if I have to.
But you know, I’ve been hacking up the extension code, and that line isn’t in it any more. Maybe I just need a better example to look at.
No, that’s not it. I do the same thing in “Objects Matching Snippets”:
Does the object match a snippet (called S):
if the item to match is a thing and S matches "[any matchable thing]", it does;
if (((((Global_Vars-->11) ofclass K2_thing))) && (( (SnippetMatches(t_0, Consult_Grammar_416)) ))) { RulebookSucceeds(19, RBNO_12); rtrue;
[ Consult_Grammar_416
range_from ! call parameter: word number of snippet start
range_words ! call parameter: snippet length
original_wn ! first word of text parsed
group_wn ! first word matched against A/B/C/... disjunction
w ! for use by individual grammar lines
rv ! for use by individual grammar lines
;
wn = range_from; original_wn = wn; rv = GPR_PREPOSITION;
w = ParseTokenStopped(SCOPE_TT, Scope_Filter_50);
if (w == GPR_FAIL) jump Fail_1; rv = w;
if ((range_words==0) || (wn-range_from==range_words)) return rv;
.Fail_1; rv = GPR_PREPOSITION; wn = original_wn;
return GPR_FAIL;
];
[ Scope_Filter_50 obj o2;
switch (scope_stage) {
1: rfalse;
2: obj=noun;
objectloop(noun ofclass Object && (((noun ofclass K2_thing) && ((Adj_37_t1_v9(noun)))))) {
o2 = noun; noun = obj;
suppress_scope_loops = true; PlaceInScope(o2, true); suppress_scope_loops = false;
noun = o2;
}
noun=obj;
3: nextbest_etype = NOTINCONTEXT_PE; return -1;
}
];
We’re still passing a basically identical scope filter to ParseTokenStopped, which ends up at ParseToken__ the same way.
Here’s a question: What’s the difference between direct invocation of a function variable using round brackets (as seen in SnippetMatches) and using indirect (as seen in ParseToken__)?
rv = (topic_gpr)(snippet/100, snippet%100);
l = indirect(scope_token);