I've written the following code:
if( [DeltaToSessionBest] > 0, 1, if( [DeltaToSessionBest] < 0, 2, 0 ) )
This code works, but I always have to go into the game to test that my code is doing it right.
To test the code without switching all the time to the game, I've tried the following code:
deltatemp = [DeltaToSessionBest] if( [deltatemp] > 0, 1, if( [deltatemp] < 0, 2, 0 ) )
I get the error "Expression error:missing EOF at 'if' at line 2:0"
Why do I want to do this? I change the code to:
deltatemp = 10 if( [deltatemp] > 0, 1, if( [deltatemp] < 0, 2, 0 ) )
Now I can run the dashboard within Dash Studio and see the result if the value is 10. Or I can test negative values:
deltatemp = -10 if( [deltatemp] > 0, 1, if( [deltatemp] < 0, 2, 0 ) )
But I can't get rid of the error "missing EOF". What ist the delimiter in NCalc for the next line?
And how can I use variables inside my NCalc code? Is "deltatemp = 10" the correct way?
I've searched inside this forum and also the internet. But I haven't found any example for NCalc code with more than one line.
Hi,
You can't have multiple lines in an NCalc formula.
What you could do is use a custom property as variable for testing purpose:
https://github.com/SHWotever/SimHub/wiki/NCalc-scripting---Introduction
You can change its value on the fly as it will update when saving the ini file.
Also as mentioned in the link above, using data replays instead of live game data while working is very handy.
"You can change its value on the fly as it will update when saving the ini file."
This is exactly what I need! How can I change a property value on the fly?
Thanks!!