RenDisco is a project for .NET to parse and execute scripts written in a subset of Ren'Py - the popular engine for creating visual novels. It allows the integration of Ren'Py-like scripts within C# applications, allowing access to the .NET ecosystem while utilising the easy-to-learn syntax of Ren'Py to create dialogue.
To get started with RenDisco, clone this repository and build the solution in your preferred .NET environment.
git clone https://github.com/aaartrtrt/RenDisco.git
cd RenDisco
dotnet build
Below is a simple example of how to use RenPySharp in your project:
using RenDisco;
string script = @"
label start:
e ""Hello, world!""
jump finish
label finish:
e ""Goodbye, world!""
return
";
RenDisco.RenpyParser parser = new RenDisco.RenpyParser();
List<RenDisco.RenpyCommand> commands = parser.Parse(script);
RenDisco.IRuntimeEngine runtime = new RenDisco.SimpleRuntimeEngine();
while (true)
{
// Check if we need to read a choice from the user
if (play.WaitingForInput)
{
Console.Write("> ");
int.TryParse(Console.ReadLine(), out int userChoice);
// Create a StepContext with the user's choice loaded
StepContext stepContext = new StepContext(userChoice - 1);
play.Step(stepContext: stepContext);
}
else
{
Console.WriteLine("-");
play.Step();
}
}
This project is licensed under the MIT License - see the LICENSE file for details.