Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C# Getting an error when trying to code an autosplitter.

IzumiC

New Coder
Hello! This is my first time posting, so please forgive me if this is a dumb question. I'm trying to cade an autosplitter for use in Livesplit. (I've edited other autosplitters in the past, but this is the first I've tried to do one closer to from scratch) After saving it and trying to run it however, I get this error on the Event Viewer.
" 'init' method compilation errors:
Line 149, Col 3: error CS1026: ) expected
Line 149, Col 3: error CS1002: ; expected

at LiveSplit.ASL.ASLMethod..ctor(String code, String name, Int32 script_line)
at LiveSplit.ASL.ASLParser.Parse(String code)
at LiveSplit.UI.Components.ASLComponent.LoadScript()
at LiveSplit.UI.Components.ASLComponent.UpdateScript() "

The line it's referring to is the second to last curly brace at the bottom, I'm not sure exactly what I'm doing wrong, but any help would be super appreciated!

C#:
init
{
    vars.basePointer = IntPtr.Zero; // Emulator virtual memory base pointer
    settings.SplitEnabled;
    settings.StartEnabled;
    settings.ResetEnabled;
    // Update split status
    vars.UpdateSplit = (Func<string, bool>)((split) => {
        if (!vars.splits[split])
        {
            vars.LogSplit(split);
            vars.splits[split] = true;
            return settings[split];
        }
        else
            return false;
    });

    // Sets memory pointers
    vars.UpdatePointers = (Action) (() => {
    // SLUS_208.60 [PS2] [NTSC-U] Nightmare Before Christmas Oogie's Revenge
        vars.chapterTimePtr = 0x00414B40;
                vars.timePtr = 0x00414B48;
        vars.chapterPtr = 0x004F2614;
                vars.healthPtr = 0x004A6BFC;
                vars.bosshpPtr = 0x004A93B8;
    // pcsx2
                vars.basePointer = 0x20000000;
                break;
    });

    // Updates game values
    vars.UpdateValues = (Action) (() => {
        uint chapterTime = 0; // Chapter Timer
    uint time = 0; // In Game Timer
        ushort chapter = 0; // Chapter ID
        byte health = 0; // Character health
        ushort bosshp = 0; // bosshp
        memory.ReadValue<uint>(new IntPtr(vars.basePointer + vars.chapterTimePtr), out chapterTime);
        memory.ReadValue<uint>(new IntPtr(vars.basePointer + vars.timePtr), out time);
        memory.ReadValue<ushort>(new IntPtr(vars.basePointer + vars.chapterPtr), out chapter);
        memory.ReadValue<byte>(new IntPtr(vars.basePointer + vars.healthPtr), out health);
        memory.ReadValue<ushort>(new IntPtr(vars.basePointer + vars.bosshpPtr), out bosshp);
    current.chapterTime= chapterTime;
        current.time = time;
        current.chapter = chapter;
        current.health = health;
    current.bosshp = bosshp;

    // Initialise values
    vars.UpdatePointer();
    vars.UpdateValues();
    }
}
 
The code is missing a concluding ); just as the compiler (not the Event Viewer) says. vars.UpdateValues should be terminated the same way as vars.UpdatePointers
 
Last edited by a moderator:

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom