0

I have a class (NpcCommands.cs) that contains general methods like GetPlayer(), SendMessage(), etc.

Is there a way to write scripts in javascript, lua, python, ruby, etc that my program can load and execute that are in some way connected to my class. By this I mean if in the script I called

NC.GetPlayer().SetHealth(15);

Where NC is a reference to my NpcCommands class it would run the GetPlayer() method which returns my player object, then be able to run a method from that object such as SetHealth();

The reason why I want it to be scripted is because there are going to be multiple Npc each with their own conditions and responses such as

if (NC.GetPlayer().HasItem(cookie)) {
    NC.GetPlayer().SetHealth(15);
} else {
    NC.SendMessage("No cookies :c");
}

1 Answer 1

0

There are plenty of samples for all lnaguages you've mentioned. Here are some links:

Python (IronPython version) is one possible choice - Integrating IronPython into your Applications.

LUA have .Net bindings too - i.e. starting links from Channel9.

C# was used for scripting since very beginning too as you can compile at run time.

JavaScript.Net (part of .Net Framework) is probably another option. AS well other JavaScript implementations for .Net.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a ton! The reason why I listed those languages is because while I was searching for a method I found these languages can be implemented but I wasn't able to find out how.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.