How to connect naninovel commands to a C# script?

Using Naninovel C# APIs: adding custom actor implementations or commands, overriding engine services, integrating with other systems, etc.
Post Reply
noa1359
Posts: 8
Joined: 17 Jan 2021 10:20

How to connect naninovel commands to a C# script?

Post 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

Elringus
admin
Posts: 538
Joined: 11 May 2020 18:03

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

Post by Elringus »

noa1359
Posts: 8
Joined: 17 Jan 2021 10:20

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

Post 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

Elringus
admin
Posts: 538
Joined: 11 May 2020 18:03

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

Post 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();
Post Reply