Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Christian P
on
Happy new year!


I would need a short support please.
I wanted to display the drivers' initials in the standigs. If I select via data bindings "initials", these are unfortunately only 2 digits. Am I doing something wrong here?

I then tried to use a script with the Data Converter and use the following code.
using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;

namespace Scripts
{
public class Initialen_Fahrer : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
// Get databinding value as string:
string frist_name = value.ToString();
string last_name = value.ToString();

// Take char 1 - 3
string fristpart = frist_name.Substring(0, 1);
string secondpart = last_name.Substring(0, 2);

// Return that to display
return fristpart + secondpart.ToUpper();
}
}
}

But unfortunately the output is not correct. It will display the first letter of the first name, which would be correct. But why does it show me by last_name again 2 letters of the first name?

Output for my name: CCH
But should be: CPR

Unfortunately, I am not a C # expert, so I would be very happy to receive support.

Next I would like to integrate the respective vehicle emblems. How must the code be constructed so that, for example, instead of "Ferrari 488 GTE" the Ferrari logo is displayed?

Many thanks for your help.
Christian