PDA

View Full Version : NPC & name maker nationality variant.



Skellan
October 8th, 2015, 14:01
I am making a variant of Ikael's wonderful NPC maker extension to include names for various nationalities such as German, French, Polish etc. I think I have worked out how to do it however, the list of names in the xml is listed as:

"Joe",
"Ted",

and so on. I was hoping to cut/paste a list of names into the xml but I don't know how to do it to include the inverted commas and comma without typing them all in (which seems a bit daunting). Does anyone know if there is a shortcut in notepad+ to do this? Sorry if this is a noob question!

Ikael
October 8th, 2015, 21:09
I am making a variant of Ikael's wonderful NPC maker extension to include names for various nationalities such as German, French, Polish etc. I think I have worked out how to do it however, the list of names in the xml is listed as:

"Joe",
"Ted",

and so on. I was hoping to cut/paste a list of names into the xml but I don't know how to do it to include the inverted commas and comma without typing them all in (which seems a bit daunting). Does anyone know if there is a shortcut in notepad+ to do this? Sorry if this is a noob question!

Originally I created the list with jEdit regex. I copy pasted massive list of names and used regex to change then into the given format. If you want to try out jEdit I can provide you search-replace regex. Basically I need sample of your list to get the matching part right

Ikael
October 8th, 2015, 21:15
Btw, names were meant to be easily extendable. Could you provide your extension so I could check "cognitively" how did you meant to to do it. I could point you to right direction if I see improvement needs. You are the first who wanted to extend this, so I am curious

Skellan
October 10th, 2015, 12:44
Hmm, ok so its broken hehe. I don't think its far off but it seems to have the names lists confused.

Don't worry about looking at this if you haven't got time, I am sure you have better things to do.

Ikael
October 10th, 2015, 14:18
Hmm, ok so its broken hehe. I don't think its far off but it seems to have the names lists confused.

Don't worry about looking at this if you haven't got time, I am sure you have better things to do.

Thanks. I was able to find bug from core NPC Maker extension which prevented custom names to be generated and it only ouput build-in fantasy male names. You should get the newest version first: NPC Maker (https://www.fantasygrounds.com/forums/showthread.php?20807-SW-NPC-Maker-extension).

Secondly I have attached sample extension which includes your german names and more. The one important difference is that when you extend names you can do it as addon extension for NPC Maker, and thus you don't need to copy the original code. This helps you to keep up with new NPC Maker version without needing to update your extension all the time. You need to enable both of these extension: "SW NPC Maker" and "SW NPC Maker addon - German names" and you will have your german names provided

In this addon approach you need to include only one file: extension.xml and do all your changes there. I attached minimized version of the file below:



<?xml version="1.0" encoding="iso-8859-1"?>
<root version="3.0">
<properties>
<name>SW NPC Maker - German names</name>
<version>0.1</version>
<author>Ikael</author>
<description>Name addon</description>
</properties>
<base>
<script name="NameListAddition">
aGermanSurnames = {
"Müller",
"Schmidt",
"Schneider",
}
aGermanMale = {
"Achim",
"Adolf",
"Albrecht",
}
aGermanFemale = {
"Achima",
"Ada",
"Adala",
}
function onInit()
NameMaker.registerNameList("German male", aGermanMale, aGermanSurnames)
NameMaker.registerNameList("German female", aGermanFemale, aGermanSurnames)
end
</script>
</base>
</root>


Here we have declared <script name="NameListAddition"> which contains all the addon code. Name of the script (NameListAddition) MUST be unique between ALL extensions used. Never use too simple names or you might cause script conflicts. Within script we define 3 list of names: 1) german surnames, 2) german male names, 3) german female names and in onInit function we register them using:


NameMaker.registerNameList("German male", aGermanMale, aGermanSurnames)

The first argument is the name of the name set which will be displayed in the name maker dropdown. Second and third arguments are name lists which we defined. Here we register two lists which will general full german names containing first and surname, such as "Ada Schmidt". If you want to have only first names you can remove the aGermanSurnames part from the registration.

Skellan
October 10th, 2015, 17:06
Wow! thank you Ikael, that is super useful. I am enjoying playing about with the extensions so I really appreciate that you took the time to break it down for me so I can see how it works. You are a star.

Skellan
October 11th, 2015, 22:26
So I have been playing about with that extension and have added lists of names for:

1920's Female
1920's Male
French Female
French Male
German Male
German Female
Norwegian Male
Norwegian Female
Polish Female
Polish Male
Old West Male
Old West Female

It appears to work ok. Thanks for your advice (and doing the hard bits)


I will add some others shortly

Mask_of_winter
October 12th, 2015, 01:51
Awesome stuff, thanks for sharing!

Skellan
October 12th, 2015, 02:08
Thanks.
I noticed its still unimaginatively called 'extension' I should really do an name extension name extension :)

Mask_of_winter
October 12th, 2015, 02:52
An extension name generator would be sweet indeed lol