Help NCalc Formula
 
Notifications
Clear all

Help NCalc Formula

12 Posts
2 Users
0 Reactions
6,578 Views
(@colonia)
Active Member
Joined: 4 years ago
Posts: 9
Topic starter  

Hello, I need help for the "When formula is True" formula in NCalc. What should this formula look like? I would like to display a checkered flag with the help of this formula in order to control an LED with "animation". But I can't find a solution. I tried the following formula:

"if ([Flag_Checkered] = 1,1,0)" and also

"if ([Flag_Checkered], 1,0)"

however, neither work. How does the formula have to be correct?

Many Thanks

Colonia


   
Quote
(@romainrob)
Honorable Member
Joined: 5 years ago
Posts: 530
 

Hi,
if ([Flag_Checkered], 1, 0)
if ([Flag_Checkered] == 1, 1, 0)

Would both correct syntax wise, but actually do nothing as the property value is already 0 or 1.
Simply use:

[Flag_Checkered]


   
ReplyQuote
(@colonia)
Active Member
Joined: 4 years ago
Posts: 9
Topic starter  

Hi Romainrob,

many thanks for your response.

But unfortunately I don't understand, I'm too stupid. Which effect should I combine that with?

I use RGB Leds. There is no [Flag_Checkered] option under "Add Effect" (only other flags such as "BlueFlag on" for example). So I wanted to create a "Custom formula", here "When formula is true" (you can choose this effect there).

But this is not possible with any "if" formula. Unfortunately, [Flag_Checkered] alone does not work either.

Please show me an example for the application of the "When formula is true" effect, or how I can use the formula you mentioned [Flag_Checkered] for RGB Leds.

Many Thanks.

Colonia

 


   
ReplyQuote
(@romainrob)
Honorable Member
Joined: 5 years ago
Posts: 530
 

@colonia
Hi.
"When the formula is true" is a group. You need to put at least one effect (static led, gradient or animation) inside.
The visisibility of the contained effect(s) will be controlled by the formula of the "When the formula is true" group.

Alternatively, for a single and simple effect you can use "Custom fomulas status led" or "Custom fomulas gradient" and have the formula directly in the effect.

Also note that the [Flag_Checkered] property does not work with every game. It depends on the data offered by the game.


   
ReplyQuote
(@colonia)
Active Member
Joined: 4 years ago
Posts: 9
Topic starter  

Hi,

Romainrob,

I know that an effect under the "When formula is true" must be used, but the formula still does not work. I have now tried both of the solutions you gave (here with a white flag because it can be checked in the Test Data Editor) Both options do not work! There is no reaction with the Test Date Editor!

Colonia


   
ReplyQuote
(@colonia)
Active Member
Joined: 4 years ago
Posts: 9
Topic starter  

And the other


   
ReplyQuote
(@romainrob)
Honorable Member
Joined: 5 years ago
Posts: 530
 

@colonia
This is not a valid test.
The data tester is meant to test built in effects.
It doesn't affect the property value itself.

If a custom flag effect doesn't trigger, try monitoring the property value while in game to see if it updates.
Not all properties work with every game.


   
ReplyQuote
(@colonia)
Active Member
Joined: 4 years ago
Posts: 9
Topic starter  

Thanks Romainrob,

I will test ist!

Colonia


   
ReplyQuote
(@colonia)
Active Member
Joined: 4 years ago
Posts: 9
Topic starter  

Hi there,

the application of a "Custom Formulas Status LED" has now worked.

Still nothing can be created with "When Formula is True". Nothing at all. There is absolutely no output that can be achieved using this formula. Not even the subsequent effect. There is just no reaction no matter what I do.

Therefore the question again, how is this formula used correctly? Maybe someone has an example in which he uses the formula.

Many Thanks.

 

Colonia


   
ReplyQuote
(@romainrob)
Honorable Member
Joined: 5 years ago
Posts: 530
 

@colonia
Hi.
Both work the same on my end.
Tested with an iRacing data replay
I included the profile if you want to try it on your end.


   
ReplyQuote
(@colonia)
Active Member
Joined: 4 years ago
Posts: 9
Topic starter  

Hi Romainrob,

many thanks for the examples and the file. It works now. 👍 

Although I don't understand why! I did everything exactly as in your example. Only I didn't have the "When formula is true" as a group.

 

Still, thank you very much for your help! 😀 

Colonia


   
ReplyQuote
(@romainrob)
Honorable Member
Joined: 5 years ago
Posts: 530
 

@colonia
You're welcome! 🙂


   
ReplyQuote
Share: