Interface Inheritance Help

Posts: 10
Hi! I am trying to use the ITelemetry interface from the SDK, however I am not able to be able to reference the values listed in the interface so that I can write statements that do what I want to do. Is there a way to properly reference the interface and then utilize it within the main Script namespace? Thank you for any help given, as I am very new to C++ and coding for ATVO.
Posts: 785
What exactly are you trying to achieve? Inheriting ITelemetry is never necessary. We gave you the interface definitions publicly so you can look up what's available in the various data objects.
Posts: 785
For reference: to actually use these values directly from the telemetry object you can go via the "sim" parameter and its Telemetry property:
var time = sim.Telemetry.SessionTime;
Posts: 10
Oh ok that makes a lot more sense! I tried this, however I'm still getting an error that prevents the code from running (it compiles fine). Sorry if this is very basic coding knowledge.

Posts: 785
There are a lot of things going wrong unfortunately. I don't really know how you can get that error with this script, but let me give it a shot:

  • You are telling the script that the input value (called "value") is of type IEntity. Is it really? This is only the case if your data binding is bound to the "entity_obj" binding. If it is another value it may be a string (like the error is telling you), or a number, etc. What is your data binding set to?
  • Even if "value" is of type IEntity, you aren't using it at all. Instead you read the FuelLevelPct value straight from the sim. The variable 'result' is never used.
  • Note that FuelLevelPct is only the fuel level for your own car. You cannot get the fuel level of other cars in the session, iRacing does not output it to you.

Check this thread for more details: https://atvo.appgineering.com/Forum/Thread/91
Posts: 10
Ah okay that makes sense. I do believe that I am using the IEntity data binding, which should correlate with the script. However I do see how the value isn't used. That being said, how would you have it so that you could output the fuel percentage as an integer or number so that you could adjust the width of a panel in correlation to the fuel level?