Excluding characters from pattern text generation

Discussion in 'License Plates' started by DanHR, Dec 1, 2024.

  1. DanHR

    DanHR
    Expand Collapse

    Joined:
    Dec 1, 2024
    Messages:
    6
    Hello guys,

    I want to create a Spain License Plates mod, but I don't know how to exclude characters from text generation, has anyone done something similar?

    The formats I have contemplated are as per follows:
    1900-1971: [1-3 letters] - [1-5 numbers]
    1971-2000: [1-2 letters] - [4 numbers] - [2 letters, not vowels except U, not Ñ, Q or R, not WC]
    2000 onwards: [4 numbers] [3 letters, not vowels, not Q or Ñ]

    For the moment I want to replicate these formats, I'll do the others in a future. Can I have some help regarding the last part? For the pre 2000 plates I'll manually add the variants as per wiki patterns, but I cannot do all combinations of letters for these exclusions
     
  2. okr

    okr
    Expand Collapse

    Joined:
    Nov 22, 2024
    Messages:
    69
    Hi, if i remember correctly @rukatsunderi has done this in his Central Europe Plates mod, where he excluded the G from the Czech plates, maybe you could ask him.
     
  3. rukatsunderi

    rukatsunderi
    Expand Collapse

    Joined:
    Oct 8, 2023
    Messages:
    44
    Hi!
    For example, for current Spanish plates (4 digits + 3 letters), the number generator should look like this:

    "gen": {
    "pattern" : [
    "%d%d%d%d %l2%l1%l1",
    ],
    "patternData":{
    "l1": ["B","C","D","F","G","H","J","K","L","M","N","P","R","S","T","V","W","X","Y","Z"],
    "l2": ["B","C","D","F","G","H","J","K","L","M","N"],
    }
    }


    You'll need to add a "patternData" element after "pattern" if it's not present there. There, you'll need to create a new patternData element - in my example above, its name is "l1" (I don't recommend to create patterns which names begin with c, D or d, as it will cause some problems). Then, in square parenthesis, supply the comma separated list of possible values (put them in quotation marks). The last step is to replace "%c" in your pattern with "%l1" (pattern name with a percent sign before).

    You can add more than one patternData element, here I added one called "l2" that will be used only for the first letter - this allows only letters from B to N to be selected, as newest Spanish plates have "M" as the first letter and issuing of combinations with letter "N" will be started probably at the beginning of 2025, so I've included this letter too.

    To exclude 2-letter combinations like "WC", you'll need to put 2-letter combinations as possible values, like: ["BB","BC","BD",...,"VZ","WB","WD","WF",...,"ZZ"]. The last value of this list may even depend on province, for example for Madrid "ZX" was last issued combination for pre-2000 system, and for Barcelona it was "XG" - you can create multiple patterns in this list, like:

    "pattern" : [
    "M %d%d%d%d %l01",
    "B %d%d%d%d %l02",
    ],


    In the example above, Madrid plates will use letters from "l01" patternData element and Barcelona from "l02" pattern (if you specify one) - if there's a big number of patternData elements, there should be 2 or even 3 digits/letters in the name and they should contain equal number of characters. For example, if there are "l1" and "l10" in the same file, "%l10" may be interpreted by game as a random character from "l1" patternData and a digit zero after it.
     
    • Like Like x 2
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice