Determining Multi or Single Dobj

Looks promising… nounList couldn’t be there for an action that doesn’t allow miltiDobj…

1 Like

Aha!

has verbProd: true
has dobjMatch: true
dobjMatch: (singleNoun(normal))

For my PeekThrough action, which only allows for singles!
Getting closer… need to make sure a comparison works, now.

1 Like

My laptop internet connection is currently down, else I’d send you my debug print func… useful all over the place!

1 Like

Problem:

        local verbProd = gCommand.verbProd;
        "has verbProd: <<(verbProd == nil) ? 'nil' : 'true'>>\n";
        local dm = verbProd.dobjMatch;
        "has dobjMatch: <<(dm == nil) ? 'nil' : 'true'>>\n";
        "dobjMatch: <<dm>>\n";
        "is single: <<(dm == singleNoun) ? 'true' : 'nil'>>\n";
        "is multi: <<(dm == nounList) ? 'true' : 'nil'>>\n";

Output:

has verbProd: true
has dobjMatch: true
dobjMatch: (nounList(nonTerminal))
is single: nil
is multi: nil

I feel like I just did something childish. How does one perform a comparison for these?

EDIT: Swapped variables.

1 Like

There are a few kinds of nounLists and singleNouns… you can see it in the libref.

Ohhh…those are classes?

Prods, yes

Heck. Tried looking it up in the libref, and it’s like a different coding language over here. I’m in the grammar section, apparently.

ValToSymbol could help here to determine what you need to compare to…

reflectionServices.t?

EDIT: Oh, reflect.h?

1 Like

Yes…

1 Like

Okay, note for future explorers:

#include "reflect.t"

is your include.

reflectionServices.valToSymbol(objDataHere)

is your execution.

Here’s my result for:

reflectionServices.valToSymbol(gCommand.verbProd.dobjMatch)

Output:

{obj:nounList(nonTerminal)}

Is that the whole object? The object is nounList(nonTerminal)? Not used to seeing parenthesis in object references…

1 Like

Try if == nounList(nonTerminal) and see what happens?

My bad… prob have to check ofKind?

Tried both. Says “nonTerminal is not a defined symbol”. I think it’s treating nounList as a method or something, and nonTerminal as an arg.

By the way, I really appreciate you helping me.


You could probably do this debugPrint as a function inst of macro…
Whoops, the ‘a’ after the @ is supposed to be ‘val’ and so is the argument to vts

1 Like

Yeah, I didn’t think entering that would work…

You could use the valToSymbol return values for your comparisons

1 Like

Vts the dobjMatch and then compare it to known values

1 Like

For any future explorers, your code for the debug function is as follows:

#ifdef __DEBUG
#include "reflect.t"
#define debugPrint(val) { local str = '\n'## #@val ## ' = <<reflectionServices.valToSymbol(val)>> \n'; \
    if (gTranscript) extraReport(str); else say(str); \
}
#endif
1 Like