Hello!
First of all, I'd like to say hi - It's my first post in here. Hi!
Now let's cut to the chase - I'm writing some simple rougelike in C++. I'm using SDL for graphics. It's not even started properly, but I'd like to make some decisions about scripting.
I'd like to add some things like AI or quests as external source that will be read on fly - either at the beginning of game, at startup, or later. I don't know yet. In some prototype I've wrote before, I used xml for items and NPC lines. It worked nicely, now I'd probably use json, but it turned out ok. It could stay that way.
However, I have no idea how to implement scripting for, let's say, quests. I want to give quest - "If you kill 10 rats, quest is finished.". How to do it? I can't call function from C++ that way, I can't just paste the code, because by the time it's already compiled(in Lisp it wouldn't be that hard, eh?*
.
I don't want to write wrapper for everything, it would be too much work. I want to have some ability to nicely work with code from outside. Is there some easy way to do it? I'd be grateful for sharing your experience or pieces of code(preferably C++, but can be some different language if there isn't much language-related magic going on). I've tried searching on my own, but people mostly write some general statements("Use scripting for X") or write too simple examples("hello world" in Lua isn't helping). I've completed some Lua tutorial, so I kind-of have some idea about how to use Lua with C++, but I have no idea about how to use Lua with C++ with OOP, and get all this to work together nicely without making my code look like some tasty, tangled spaghetti.
Thanks in advance!
*Yes. I like Lisp. Great language!