Menu

Extensions

AntifreeZZe

Extensions

Available for version 1.2.0+

What is extension?

Extension - is a library that adds additional actions that can executed with operator x

Actions are adding to positions 100+, so you can use x on cell with value 0 to simply add 100 to value of current cell. For example, code

nx+x

executes action with number 101

How to create extension?

You can create your own extension with any C#.NET IDE, or gedit and gmcs.

Create a new library project, add SlainBrain.Core library(Without "Local Copy" in Mono), create a class named Injector with void Inject(SBCore c). In void Inject(SBCore* c), you must call method <your SBCore>.AddAction(<num>,<action>) from SlainBrain.Core as many times as need to inject all methods. <action> is instance of class implementing IAction interface from SlainBrain.Core, Do(int[] args) method, and count field. <num> is a number of your action. If it is smaller than 100, SB API will add 100 to it.

Then,you must add line containing full path to your extension in <path to your SlainBrain.Core>/extensions.cfg

Example:

using System;
using SlainBrain.Core;
using SlainBrain.API.DotNet;
public class Injector{
    public void Inject(SBCore`*` c){
        c.AddAction(101,new MyAction());
    }
}
public class MyAction : IAction{
    public int count = 0;
    public void Do(int[] args){
        Console.WriteLine("It works!");
    }
}

How to use it

nx+x

Output : "It works!"