Sorry to bump this old topic, type = "CUSTOM"

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


  • I'm hoping one of you guys will know, I'm trying to use the Type = "CUSTOM" for a vehicle (bus) destination blind, as below


    labels = {

    {

    alignment = "CENTER",

    alpha = 3,

    alphaMode = "CUTOUT",

    childId = "20_body_1",

    color = { 0.8862743973732, 0.88627451658249, 0.19115723669529, },

    filter = "NONE",

    fitting = "SCALE",

    nLines = 1,

    params = { },

    renderMode = "EMISSIVE",

    size = { 0.85000002384186, 0.15999999642372, },

    transf = { -4.3711388286738e-08, 1, 0, 0, 4.3711388286738e-08, 1.9106854651647e-15, 1, 0, 1, 4.3711388286738e-08, -4.3711388286738e-08, 0, 4.7600002288818, -0.73000001907349, 2.5099999904633, 1, },

    type = "CUSTOM",

    verticalAlignment = "BOTTOM",

    },


    The issue I have is where & what string is needed to make my "CUSTOM" show "LIMITED STOP" for example?

    Many thanks

  • You may take a look at the wiki, according to it it is only for constructions, not vehicles: https://www.transportfever2.co…modding:resourcetypes:mdl

    Yeah, I read that,

    Label List


    In Transport Fever 2, vehicles and constructions may display some dynamic text labels. These are defined in a labelList block in the model metadata which contains a labels list:

    Code
      ..  labelList = {    labels = {      {        type = "LINE_NAME",        transf = { 0, -1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -5.8043 , 0.1814, 2.808 , 1, },        size = { 0.366, 0.210 },        color = {247 / 255, 147 / 255, 33 /255},        fitting = "CUT",        alignment = "CENTER",        filter = "NUMBER",        renderMode = "EMISSIVE",        childId = "RootNode",      },      ...    },  },  ..

    There are many different properties which can be used to define the labels.

    To set the position of the label, use the transf property pointing to the coordinates where the lower left corner of the label should be. The label will be placed aligned to the X and Z axis. The coordinates are relative to the mesh that is referenced in childID by name.

    The size contains a pair of two values. The first for the size in x direction, the second for the size in y direction, both relative to the transf. Negative values will result in no text visible. The y direction is used for the fontsize too. To use the label with more than one line of text, set nLines to a value larger than 1. Values below 1 are ignored.

    Coloring the text is possible by using the color attribute. It receives a vector with three values, one for each color in the range between 0 and 1. The transparency of the text is set by alpha. Value 0 is invisible, value 1 is opaque, values greater than 1 might lead to artifacts. With the alphaMode, it is possible to define how the alphablending is done. Possible values are either “CUTOUT”, “BLEND” or “NONE”. In Front of opaque textures, this might be irrelevant, but on transparent faces like glass panes it might be more relevant. To get emissive text (like with LCD destination displays), set the renderMode to “EMISSIVE”, otherwise set it to “STD”.

    The horizontal alignment of the text can be set in alignment with the values “LEFT”, “CENTER” and “RIGHT”. For the vertical alignment, set verticalAlignment either to “BOTTOM”, “CENTER” or “TOP”.

    To adjust the behavior of text that is longer than the label, set fitting either to:

    • “NONE” to let it overflow.
    • “CUT” to cut excessive text.
    • “SCALE” to scale down until it fits in the horizontal size.

    The type property contains one of the following keys:

    • “NONE” is applicable to all models and shows nothing.
    • “LINE_NAME” is applicable to vehicles and shows the name of the line that the vehicle is currently on.
    • “NEXT_STOP” is applicable to vehicles and shows the name of the next stop of the vehicle.
    • “NAME” is applicable to any model and shows the name of the entity (vehicle, construction, …).
    • “COMPANY_NAME” is applicable to any model and shows the name of the company.
    • “STATION_NAME” is applicable to any station model and shows the station name.
    • “CUSTOM” shows some custom content based on a labelText property in the construction.


    If it does only work for constructions, then that is a pity, I was sure someone would have worked it out if it was possible.

  • Please don't dump whole texts, use a relevant quote.


    Simply speaking you can't dynamical us this for vehicles. The text will be received from the entity construction at render stage. There is simply no code branch that this could work.

    Note: from a engine standpoint rebuilding a construction for changing a text label wouldn't be a good idea either. Changing something always means, you have to rebuild a entity component in some way.


    You can use Filter set to CUSTOM (except CommonAPI2 LINE_DESTINATION*) and use the regex as static text, or use some regex processing to store data in the name and show it.


    CommonAPI2 does in fact adds a infrastructure to bind data to line entities.

  • You can use Filter set to CUSTOM (except CommonAPI2 LINE_DESTINATION*) and use the regex as static text, or use some regex processing to store data in the name and show it.


    CommonAPI2 does in fact adds a infrastructure to bind data to line entities.

    Hi sorry about the previous post.

    i assumed that some adaptation of the code used to make the "LINE_DESCRIPTION" one to work could be used.


    Could you please explain how to use & what is regex.

BlueBrixx