How to connect naninovel commands to a C# script?

Posted: 17 Jan 2021 10:23
by noa1359

I wrote a script in C# for daily rewards and on certain days I want to add items to a Naninovel inventory
Is it possible to use the command @additem on a C# script? If so, how?
Thank you so much! <3


Re: How to connect naninovel commands to a C# script?

Posted: 17 Jan 2021 11:29
by Elringus

Re: How to connect naninovel commands to a C# script?

Posted: 17 Jan 2021 19:41
by noa1359
Elringus wrote: 17 Jan 2021 11:29

Sure, it's possible, check https://naninovel.com/guide/custom-commands

Hi, thank you for your help! I'm trying to understand the doc but I'm not sure how to practically write the command I want to use in C# haha.
It's a little bit complex for me to understand everything that's written


Re: How to connect naninovel commands to a C# script?

Posted: 18 Jan 2021 08:20
by Elringus

Sorry, didn't initially get the message right. It's possible to execute any existing command in C# by simply creating instance of that command and manually invoking ExecuteAsync method. Eg, for additem:

Code: Select all

var addItem = new AddItem { ItemId = "Item", SlotId = "Slot", Amount = 3 };
await addItem.ExecuteAsync();