I was browsing through the lexicon for some string manipulation functions. I'm wondering if there's an easy way that I can get the players first name and last name by looking for the first space in the string (assuming they dont put something like John Claude Van Dam). Is such a thing possible to do purely from a script?
String Manip
Débuté par
Tiggers.no.tail
, juil. 02 2011 06:18
#1
Posté 02 juillet 2011 - 06:18
#2
Posté 02 juillet 2011 - 06:25
#include "x3_inc_string"
void main()
{
object oPC= GetFirstPC();
string sFullName = GetName(oPC);
string sFirstName = StringParse(sFullName);
string sLastName = StringRemoveParsed(sFullName,sFirstName);
}
void main()
{
object oPC= GetFirstPC();
string sFullName = GetName(oPC);
string sFirstName = StringParse(sFullName);
string sLastName = StringRemoveParsed(sFullName,sFirstName);
}
#3
Posté 02 juillet 2011 - 06:35
The best way is with nwnx, using dragonsong's nwnx_letoscript or acaos' nwnx_funcs. Either can retrieve first and last individually. Past that, it's impossible to do with complete confidence, because you never know what characters the player has used in his name. I think there are a few sample attempts floating around the old bioboards - you might have a look with the omnibus. None of them will work correctly 100% of the time like the nwnx solutions, though.
[Edit]
I see LF beat me to the punch. the x3 include just looks for the space, which won't always work.
Funky
[Edit]
I see LF beat me to the punch. the x3 include just looks for the space, which won't always work.
Funky
Modifié par FunkySwerve, 02 juillet 2011 - 06:37 .
#4
Posté 02 juillet 2011 - 06:45
Well as long as it works most the time.





Retour en haut






