This is a silly question, and I suspect the answer is Programming, but I'd like to hear peoples opinions on this.
I've recently got back into nwnx development, and managed to port some of the functionality over to c# which is what I am more akin to, than c++.
So my question is this, lets imagine you have a translation function in nwnscript, that loops through a string, and replaces characters with other combinations of characters, to form a pseudo translated string.
Eg: Common to Pixie for example.
This functionality in nwnscript, from a technical point of view seems like it might involve alot more opcalls and internal method calls, than just having the method in a programming language.
(Im taking an example from SimTools here)
I'm just wondering if performance-wise, is there benefit to porting long operations such as this, to a nwnx method, which then returns the translated string back to nwn?
I am also trying to build a system that can translate pixie back to common.
In simtools, this isn't actually done, SimTools just sends the message to the people who know the language, before it is translated, and then speaks the translated version out loud for other observers to hear.
What I am attempting to do, is have it so players could actually type in the Pixie phrases, and then have them translated to English (Common)
Unfortunately, the backwards translation is not as easy as the Common to Pixie.
string ConvertPixie(string sLetter)
{
if (GetStringLength(sLetter) > 1)
sLetter = GetStringLeft(sLetter, 1);
string sTranslate = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int iTrans = FindSubString(sTranslate, sLetter);
switch (iTrans)
{
case 0: return "eg";
case 1: return "o";
case 2: return "s";
case 3: return "";
case 4: return "it";
case 5: return "th";
case 6: return "oo";
case 7: return "n";
case 8: return "e";
case 9: return "ta";
case 10: return "";
case 11: return "an";
case 12: return "a";
case 13: return "ei";
case 14: return "i";
case 15: return "k";
case 16: return "ca";
case 17: return "t";
case 18: return "l";
case 19: return "m";
case 20: return "ya";
case 21: return "d";
case 22: return "v";
case 23: return "p";
case 24: return "ni";
case 25: return "z";
case 26: return "Eg";
case 27: return "O";
case 28: return "S";
case 29: return "'";
case 30: return "It";
case 31: return "Th";
case 32: return "Oo";
case 33: return "N";
case 34: return "E";
case 35: return "Ta";
case 36: return "'";
case 37: return "An";
case 38: return "A";
case 39: return "Ei";
case 40: return "I";
case 41: return "K";
case 42: return "Ca";
case 43: return "T";
case 44: return "L";
case 45: return "M";
case 46: return "Ya";
case 47: return "D";
case 48: return "V";
case 49: return "P";
case 50: return "Ni";
case 51: return "Z";
default: return sLetter;
}
return "";
}
Seems when Pixie language was made in Simtools, no such 1 to 1 mapping.
Anyone see any potential ways to translate from Pixie, back to English - given the alphabet you see above?
Capitol D and K both share the ' character, which means the returned string would be kinda ambiguous.
Oooh, I just thought... Because im using C#, I could actually interface this to online translation services?