Aller au contenu

Photo

Getting/setting PC's last name (help needed, please)


  • Veuillez vous connecter pour répondre
31 réponses à ce sujet

#26
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
Perhaps a script that breaks the names up, in various formats based on space location, and then asks the PC in a convo to select the portion of it that is the last name?

To use the "John James de la pays de Gaunt" name example, your options would be:

1: James de la pays de Gaunt
2: de la pays de Gaunt
3: la pays de Gaunt
4: pays de Gaunt
5: de Gaunt
6: Gaunt
7: No last name

Not ideal still, but it does beat trying to guess the naming conventions the player used. The next step in the conversation could be in selecting the family, if more than one would be applicable.

#27
_six

_six
  • Members
  • 919 messages
Part of the problem in coding this comes in deciphering how much of the name is there only for clarification. For instance Edward Elric von Hohenheim could be first name Edward, middle name Elric, with von Hohenheim taking the place of a surname. Or it could be Edward Elric who happens to live in Hohenheim (or is the son of Hohenheim, maybe). There's no real way of determining the intent from grammar alone.

However, calling him Lord von Hohenheim makes sense in either situation, which is why I lean towards the first connective approach as a simple catch-all. However, when referring to a family as a whole, Este has quite rightly pointed out a major flaw. This has got me thinking, and the presenting the player with options might be the best idea, albeit a convoluted and more complex one. I have the image in my head of giving the player a slider to slide back and forth across the name where they want to 'slice' it, but thats not really doable in NWN.

Another might be to request name re-input by the player using the chat bar on entering the module. This would remove the need for any scripted calculations. But it'd also feel a little spoilsportish.

Modifié par _six, 31 août 2011 - 07:29 .


#28
Failed.Bard

Failed.Bard
  • Members
  • 774 messages

_six wrote...
However, calling him Lord von Hohenheim makes sense in either situation, which is why I lean towards the first connective approach as a simple catch-all. However, when referring to a family as a whole, Este has quite rightly pointed out a major flaw. This has got me thinking, and the presenting the player with options might be the best idea, albeit a convoluted and more complex one. I have the image in my head of giving the player a slider to slide back and forth across the name where they want to 'slice' it, but thats not really doable in NWN.


  Actually, I think with coloured text, that would be doable.

  The name would be displayed as a token, cursor move back and forth options in the convo.  Set start of last name, set end, and finished for options.

  I'll post findings on it as soon as I finish writing it up.

#29
Estelindis

Estelindis
  • Members
  • 3 699 messages

OldMansBeard wrote...

This is starting to get interesting! Coding aside, it's obviously not enough to parse the full name syntactically into words and spaces; we need to consider the semantics too.  <snip>  There are different conventions at work. If we can define a set of rules that cover most cases (rather than the single rule of "take the last word", which was my starting point), we can probably code them.

Indeed!  I'm glad this has ended up offering so much food for thought...  *ponders problem*

Let's imagine that, after finding all the sub-strings separated by spaces, we identify some of them as prepositions and conjunctions by checking them against a list.  (If we identify no such sub-strings, we just use the standard method of making the first word the first name and the last word the last name.)  Of the femaining words, our default position is that whatever sub-string (possibly including spaces) comes before the first conjunction or preposition (excluding any conjunction or preposition that might begin the whole string) is the most important part of the first name.  Similarly, whatever sub-string comes after the last conjunction or preposition is taken to be the most important part of the last name. 

That was quite a mouthful, so, to summarise: The Duke of the Dark Plains of Lirandon -> Duke Lirandon.

Under these rules, OMB's list of names would yield the following results; non-ideal results are bolded:

  • John James the Gaunt -> John James (first name), Gaunt (last name)
  • John James of the Gaunt Countenance -> John James (first name), Gaunt Countenance (last name)
  • John James of Gaunt -> John James (first name), Gaunt (last name)
  • John James Gaunt -> John (first name), Gaunt (last name)
  • Gaunt John James -> Gaunt (first name), James(last name)
  • John James de la pays de Gaunt -> John James (first name), Gaunt (last name)
  • John James de la Pays -> John James (first name), Pays (last name)
  • John James de Gaunt -> John James (first name), Gaunt (last name)
  • John de Gaunt James -> John (first name), Gaunt James (last name)
  • John James von Hohen Gaunt -> John James (first name), Hohen Gaunt (last name)
  • John von Hohen-Gaunt James -> John (first name), Hohen-Gaunt James (last name)
  • John James -> John (first name), James (last name)
  • John Jamessohn -> John (first name), Jamessohn (last name)
 

Of all these, the ones that cause problems are those that have adjectives and nouns playing together, but I cannot think of any way of distinguishing between nouns and adjectives that is not mind-bogglingly clunky.  It's possible we might be able to weed out titles that people put into their names, though, as the list of titles is relatively small compared to, say, all adjectives.  ;-)

To make provision for eventualities not covered by this system, we could follow Bard's idea of letting the PC choose from a number of possibilities via conversation.  I think I'd have the character in my module find out about his or her family through an old book; the PC would get the chance to choose a "best" translation of the family name through that conversation, with possible options for choosing being set via script and the player having the option to type a name into the chat window as a last resort.

Modifié par Estelindis, 31 août 2011 - 10:28 .


#30
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
Okay, the script is finished.  There's a clip as an example of how it works here:





New permanent link here:

  String parsing in that way is far more annoying to script than I expected.

Edit:  Sorry for the quality, or lack thereof, in the video.  It's enough to give an example though, even if the text is hard to read.

Modifié par Failed.Bard, 21 septembre 2011 - 11:40 .


#31
Estelindis

Estelindis
  • Members
  • 3 699 messages
Just took a look, Failed.Bard... Not bad at all! I'm very impressed. :-) Something like that wouldn't be too immersion-breaking for the "translate name from strange old alphabet in ancient book" scenario I was considering... The moving cursor would be just like the scholar's finger moving under a line of text. :-D

#32
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
It was, essentially, _six's idea, I hadn't considered having the player select the portion to use until he'd mentioned it.
That convo would still need to be preceded by a check to see if they have a last name at all, or have an option added to it for "[No last name.]", and I likely should have deleted all of the variables I used at the end, but it's a decent starting point if you decide to use it.