Execute a script in another language?

I have a folder with addon characters that changes frequently, so I've coded a C# script that adds all characters (and some other) files in cfg file.

To execute the script, I need to go to the terminal each time, so I was wondering is there any way to execute the script written in C# throught the game? I know I should just execute a Lua file, but i don't know any Lua!

In order to execute this script, I use command: "dotnet run --project <project-file>"

Script written is bellow

Adding all characters in cfg automatically:
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

string _cfgFilePath = "/Users/arturagalarian/srb2/addons/BUNDLES/all-chars.cfg";
string _charDirPath = "/Users/arturagalarian/srb2/addons/characters";
FileInfo[] _charFiles = new DirectoryInfo(_charDirPath).GetFiles();

string _cuctomSaveFileName = "V_customsave - v1.soc";

List<string> _linesToAdd = new List<string>(_charFiles.Length);

_linesToAdd.AddRange(_charFiles.Select(file => file.Name ).Where(fileName => Regex.IsMatch(fileName, @"\.(wad|pk3)$")));
_linesToAdd.Add(_cuctomSaveFileName);

File.WriteAllLines(_cfgFilePath, _linesToAdd);
 
Last edited:

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top