Issue with computed...
 
Notifications
Clear all

Issue with computed color function for ArcColor of gauge

3 Posts
2 Users
1 Likes
1,324 Views
(@fugazicoverband)
New Member
Joined: 3 years ago
Posts: 1
Topic starter  

Hi, I'm trying to change the color of the arc of a gauge and it doesn't seem to want to work. The code is working everywhere else I want it applied, but doesn't seem to want to change the Arc color itself.

Here's the code:

if([GameRawData.TruckValues.CurrentValues.ElectricEnabled],1,0)

 

The raw results look correct (Engine electric on in game results in a 1, off results in a 0).

I have it set to Computed Color option.

0 = the darker color, 1 = the lighter color I want displayed when engine is on.

Screenshot of settings for color

I've tried in Javascript as well and no dice.

Anyone have any ideas? Does the computed color just not work for Arc? As I said, this bit of code works fine for computed color on other elements of the gauge (the ticks mainly), but the Arc seems stubborn.

Thanks!

 

 


   
Quote
(@mac_fodder)
New Member
Joined: 2 years ago
Posts: 2
 

I know this is a long shot, but did you ever figure out your issue? I'm having the same thing. The RAW result is working as it should, but the color will not shift from the start color even as the raw results changes. 


   
ReplyQuote
(@mac_fodder)
New Member
Joined: 2 years ago
Posts: 2
 

SOLVED

Just incase anyone else ends up here.

First some Context: I have a linear gauge that calculates how much distance is left on a stage in DR2. When I get to 2500 Meters from the finish I want the gauge to go from red to green letting me know that if I do catch a puncture it's faster to just drive it out than to swap it. The distance is not 100% but you get the idea. It's a quick visual cue. Now I didn't want a hard change as if it's Tarmac then maybe 3000 meters it still fine but if it's snow and rwd car, then maybe 1500 meters would be the distance. So I wanted a gradient letting me know I'm at the threshold. 

[TrackLength]-[GameRawData.LapDistance]

Gives me the the distance remaining in meters. So I set the start color at 30000 Meters (catches all stage lengths) the midpoint at 2500 and the end at 0. 

 

Solution: 

It seems like the Gauge Color Binding cannot calculate downward. The start color needs to be less then the end color for it to work. Swap the Math!

 [GameRawData.LapDistance]-[TrackLength]

This will give you a negative number that will approach 0 as you get towards the end. The calculated number is less then the end color so now the Gauge works as intended.

 

Hope this helps anyone else finding themselves stuck for way longer than I'm willing to admit. 


   
dadima reacted
ReplyQuote
Share: