Author Topic: GetName  (Read 334 times)

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
GetName
« on: September 24, 2013, 04:20:29 am »


               I am working on a cutscene in which I spawn a young boy or girl depending on the PC's Gender. It is a dream where the Pc views themself as a child. The PC is in the Cutscene Ghost Mode. I would like to have a npc call the PC by first name(BubbleText).
I know that in coversation files you can use the tokens,<FirstName>, <LastName> ect..., but these do not work in ActionSpeakString.
I know that the name is a string.
Questions:
Is there any way to devide that string, and get just the first or last name ?
Is there anyway to create a custom token that could get the same ?
Finally, if 10 pounds of milk makes a pound of butter, and one pound of chicken makes a very small chicken,
How many chickens do you have to pound to make a pound of chicken butter ?(Yes I know, I put the ill in silly)
Ed
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
GetName
« Reply #1 on: September 24, 2013, 04:26:15 am »


               Here's what I recently gave in response to a pm:

As for a GetFirstName function, you have to use nwnx to do it properly,
though there are workarounds that work for most names, by using spaces
to guess it. Here is one such function by Axe Murderer:

string GetFirstName(object oCreature) {

        if (!GetIsObjectValid(oCreature))
                return "";

        string sName = GetName(oCreature);
        int iPos = FindSubString(sName, " ");

        if (iPos < 0)//if there's no space, FSS returns -1, return the full name
                return sName;

        while(iPos == 0) {
                sName = GetStringRight(sName, GetStringLength(sName) -1);
                iPos = FindSubString(sName, " ");
        }

        return ((iPos < 0) ? sName : GetStringLeft(sName, iPos));
}

               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
GetName
« Reply #2 on: September 25, 2013, 04:05:13 am »


               Wow ! 10 monkeys with typewriters would have come up with that before me. You people are good.
Thanks for the info. I will take some time to study this and give it a whirl.
Ed
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
GetName
« Reply #3 on: September 25, 2013, 12:55:24 pm »


               Here's a bunch more info posted awhile back if you feel like perusing:

social.bioware.com/forum/1/topic/192/index/8226723