Skip to content

API Documentation

leonarudo edited this page Apr 9, 2023 · 5 revisions

API Documentation

Project Setup

If you use Visual Studio 2022 choose: home -> new Project -> class library (.NET Framework 4.8)
Than in your project Dependencies -> Add Project Reference -> and add the latest realesed TLD_AdvancedComputerMod.dll and TLDLoader.dll from the The Long Drive Mod Workshop

If your not using Visual Studio, just make sure that u attach TLD_AdvancedComputerMod.dll and TLDLoader.dll to your project

Adding Commands

The ACM_ICommand class makes it easy to add new commands to the computer without having this stupid ?Syntax Error written on the screen.
To add a command to the computer, you just need to write a class that uses the ACM_ICommand class.

//https://github.com/BoettcherDasOriginal/TLD_AdvancedComputerMod/blob/main/ACM_TestPlugin/ACM_TestPlugin.cs
//ACM_TestPlugin.cs

using System;
using TLD_AdvancedComputerMod.ACM_OS;

namespace ACM_TestPlugin
{
    public class ACM_TestPlugin : ACM_ICommand
    {
        public override string Name { get { return "test"; } }
        public override string Description { get { return "plugin test"; } }
        public override Action CommandFunction { get { return () => Command(); } }
        public override Action HelpFunction { get { return () => Help(); } }
        private string[] _InputProperties;
        public override string[] Arguments { get { return _InputProperties; } set { _InputProperties = value; } }
        private computerscript _cmp;
        public override computerscript cmp { get { return _cmp; } set { _cmp = value; } }
        private ACMConsole _Console;
        public override ACMConsole console { get { return _Console; } set { _Console = value; } }

        public void Command()
        {
            console.WriteLine("Test Test 1,2,3!");
        }
        public void Help()
        {
            
        }
    }
}
  • Name -> the name of your command
  • Description -> the description of your command
  • InputProperties -> the given parameter from the user
  • Command() -> the main function of your command

The ACMConsole

The ACMConsole class provides you with useful functions for your command and is automatically set up in your ACM_ICommand class. There are currently only a few pre-built features, but more will be added in the future.

Variables

var Description
computerscript cmp The currently linked computerscript

Methods

Method Description
Write(String) Writes the specified string to the defined computerscript screen.
WriteLine(String) Writes the specified string value, followed by the current line terminator, to the defined computerscript screen.
Clone this wiki locally