Neutral Library Messages

version 3/120107 by Aaron Reed

  • Home page
  • Beginning
  • Previous



  • Chapter - Utility Functions
        
    To decide which snippet is the misunderstood word:
        (- (((wn - 1) * 100) + 1) -).

    To decide if the misunderstood word is known elsewhere:
        (- (wn--, NextWord() ~= 0) -).

    To decide which snippet is the quoted verb:
        (- ((verb_wordnum * 100) + 1) -) .

    To decide what number is position of non-dictionary word:
        (- (FindUnknownWordToken(2)) -).

    [To decide which snippet is what was misunderstood:
        (- (((wn - 1) * 100) + (WordCount() - 2)) -).]
        
    [To say show matched action: (- show_matched_action(); -).]



    Include (-
    [ show_matched_action m;
        for (m=0 : m<32 : m++) pattern-->m = pattern2-->m;
        pcount = pcount2;
        PrintCommand(0);
    ];
    -).

    [Code from Unknown Word Error by Neil. Thanks!!]

    Include (-
    [ FindUnknownWordToken wordnum w twn numwds;
        #ifdef TARGET_GLULX;
        numwds = parse-->0;
        #ifnot;
        numwds = parse->1;
        #endif; ! TARGET_GLULX;
        ! Throw out invalid word numbers
        if (wordnum <= 0 || wordnum > numwds) rfalse;
        twn=wn; ! save the value of wn so it can be restored
        wn=wordnum;
        while (1) {
            w=NextWordStopped();
            if (w == -1) { wn=twn; rfalse; }
            if (w == 0 && TryNumber(wn-1) == -1000) {
                wordnum=wn-1;
                wn=twn;
                return wordnum;
            }
        }
    ];
    -)


    Neutral Library Messages ends here.