Vindictus Wiki
Advertisement


Explanation

The first part of the code defines a variable char which is an ordered list of a-f corresponding to the characters in order from Lann to Vella based on whether or not the name of the corresponding character is present in {{{1}}}. This is done by looking for each character in order and adding their letter to the string if they are in the input.


So if we recieved "Vella Evie Fiona" we would check for Lann, no lann so we skip 'a', check for Fiona, we have a Fiona so add a 'b', check for Evie, we have an Evie so we add a 'c', etc. until char would equal "bcf". b for Fiona, c for Evie, and f for Vella.


The second part is a series of switches that basically goes through char one letter at a time, turning the ordered letters into a comma separated list.


So with our example "Vella Evie Fiona" which turned into "bcf" we find 'b' first and add "Fiona" to the beginning of the list. The string is longer than 1 so it adds ", " and keeps going where it finds a 'c' which means it adds "Evie". The string is longer than 2 so it adds ", " and continues to the 'f' which adds "Vella". The string is not longer than 3 so it stops. We end up with "Fiona, Evie, Vella."


There are a couple special cases in the second half. If char has 0 length the result is immediately "" rather than going through the list. If char is 6 letters long all the characters are in the list. There is only one combination of all things within a set, so it just uses a predefined list.


Adding a new character:

  • In this first half copy the {{#if:{{#pos:{{lc:{{{1}}}}}|<character name>}}|<letter>|}}}} code and insert it with the proper values. The order of these statements is what determines the order of the letters, and hence the resulting list.
  • In the second part increment the first case of the switch (currently "6=" so it would become "7=") and add the new character to the predefined list.
  • Add the new character and it's letter to each of the switch statements that switch on {{#sub:{{#var:char}}
  • Follow the pattern of the |#default case of the switch. The last switch should look like:
...}}{{#ifexpr:{{#len:{{#var:char}}}}>(number of characters-1)|,
{{#switch:{{#sub:{{#var:char}}|(number of characters-1)|1}}
|(Second to last letter)=[[(second to last char)]]
|(last letter)=[[(last char)]]}}


Usage

Given a list of characters, this templates orders them properly and formats them as links.

Example

{{CharacterList|Lann Evie}} produces Lann, Evie

{{CharacterList|Karok Lann Fiona}} produces Lann, Fiona, Karok

{{CharacterList|Karok Lann Fiona Lynn}} produces Lann, Fiona, Karok, Lynn

{{CharacterList|Hurk Lynn Arisha}} produces Hurk, Lynn, Arisha

{{CharacterList|Miri Grimden}} produces Miri, Grimden

{{CharacterList|Grimden Eira}} produces Grimden, Eira

{{CharacterList|Eira Lethor}} produces Eira, Lethor

{{CharacterList|Eira Kael}} produces Eira, Kael

{{CharacterList|Tessa Dan-Ah}} produces Tessa, Dan-Ah

Advertisement