07th-mod / higurashi-assembly

9 stars 8 forks source link

"Unhandled Operation" Error during script compile is only logged but not thrown otherwise signalled #132

Open drojf opened 1 month ago

drojf commented 1 month ago

I was testing hou+ using the standalone compiler, and noticed two errors were output while compiling &opening.txt.

void OpeningLaunch()
{
    if (GetGlobalFlag(GVideoOpening) >= 3) {
        PlayOriginMovie();
    }
}

void OpeningStory()
{
    if (GetGlobalFlag(GVideoOpening) >= 2) {
        SetGlobalFlag(GVideoOpening, 3);
        PlayOriginMovie();
    }
}

void PlayOriginMovie()
{
    if (GetGlobalFlag(GArtStyle) == 2) {
        // Play OG video if using OG artstyle
        PlayVideo("video/mv13-pc.mp4", 1920, 1080);
    } else {
        // Otherwise play console art style
        PlayVideo("video/mv13-cs.mp4", 1920, 1080);
    }
}

The error is that PlayOriginMovie(); should actually be CallSection("PlayOriginMovie");

I'm not sure if this works anyway, even without the CallSection, as the movie does seem to play.

But I was wondering how we've been running CI/building the scripts without noticing this error. I then checked where the error was raised:

        public void ParseOperation(ITree tree)
        {
            name = tree.GetChild(0).Text;
            line = tree.Line;
            BGIParameters param = (tree.ChildCount <= 1) ? new BGIParameters() : new BGIParameters(tree.GetChild(1));
            if (paramLookup.ContainsKey(name))
            {
                OutputCmd(name, param);
                return;
            }
            Debug.LogError("Unhandled Operation " + name);
            CmdOpNull();
        }

It looks like the error is just printed out, but there is no signalling during compile that an error occurred, so the compiler thinks everything is OK.


Will need to check whether this was done deliberately (as the script seems to work anyway under this condition).

But personally, since this only happens if there is a genuine error, I would want to throw an exception and tell the developer to fix the script (since it should usually be an easy fix).


Also check if this applies to previous chapters (apply this fix to the mod branch)