Yes, you can do that and much more -- if you have sufficient programming knowledge in C# or C++.
For one, you can most likely do it by writing a custom NWNX plugin. However, the easier way is to use Skywing's amazing NWScript Accelerator plugin: http://www.nwnx.org/...opic.php?t=1803 and then enable Managed Scripts (http://www.nwnx.org/...969220a96469db9).
This will allow you to write C# programs that run like NWScripts and can be called from nwn2, and have access to all nwn2 scripting functions. For example in my case, I track a ton of analytics data on Mixpanel using a small C# script I wrote which basically relays JSON data.
Here's the relevant part of my C# program:
public Int32 ScriptMain([In] object[] ScriptParameters, [In] Int32 DefaultReturnCode)
{
if (GetIsObjectValid(OBJECT_SELF) == 1)
{
var publicKey = GetPCPublicCDKey(OBJECT_SELF);
if (publicKey != "" && publicKey != null)
{
var mixpanel = new Zirpl.Metrics.MixPanel.HttpApi.MixPanelApi("<my api key>");
var mEvent = mixpanel.CreatePersonSetEvent(publicKey);
mEvent.Properties.Add("$name", GetPCPlayerName(OBJECT_SELF));
mEvent.Properties.Add("Character", GetName(OBJECT_SELF));
mEvent.Properties.Add("Level", GetTotalLevels(OBJECT_SELF, 0));
mEvent.Properties.Add("$last_login", DateTime.Now);
mixpanel.Send(mEvent);
//Broadcast Event to DMs
//SendMessageToAllDMs("[TRACK PLAYER] " + GetName(OBJECT_SELF) + " : " + GetPCPlayerName(OBJECT_SELF));
}
}
return DefaultReturnCode;
}
As you'll no doubt notice, I'm basically just reading info about the calling object then sending that data to mixpanel (analytics platform) via an asynchronous web call. You can likely do the same thing with the filesystem.
Here is what my actual NWScript code looks like:
//Track information about a given player
//Calls a C# script which transfers people info to Mixpanel
void TrackPlayer(object oPlayer)
{
ExecuteScriptEnhanced("MixpanelPeople",oPlayer,TRUE);
}
You can just as easily add parameters to be sent to the script as well using AddScriptParameter or by setting them as local variables on the object.
The sky is the limit, and it took me no time at all to get it working (Skywing documents his projects very nicely).
Hope this helps!