Obligatory first post, Wotever, you've made a masterpiece. Worth every cent, I've spent hours making dashboards just for fun, but I'm now coming to a bit of an issue: I'm not explicitly a coder. I can read and interpret code, but like a toddler with a biro, the scrawling that comes from my keyboard is illegible from a programming point of view.
That said...
Why is there no explicit documentation on what you can and can't do in NCalc, let alone which of these transfer to Simhub. I'm trying to create a Stint Timer. Counting from Pit out, because that's how they all work, apparently. I can just about convince the PC to give me an "if <notinpit=0>" but counting the seconds is... yeah. I've seen DataCorePlugin.GameData.NewData.StintOdo from someone that doesn't appear in the game properties within simhub, which I also don't understand.
I guess what I would like is either some repo so I can learn how to use Simhub better, or if someone can do the thing really quickly for me, that would also work, but you know, it's not the best to keep me from asking more questions 😛
Hello Eike. I can tell you that I was exactly in the same position when I started using SimHub not long ago. I immediately discovered the potential of this amazing software, but I had 0 experience with coding (literally 0). But I was committed in learning, so I watched all of the Youtube tutorial series of AdamHeart and David Weber and I slowly started to understand the basics and the logic behind the creation of dashboards and how to properly use functions and properties.
I'm not an expert by any means now, but I have been able to create my own dashboard with all the features I wanted from the beginning and I'm very satisfied with it.
I would like to have a sort of NCalc manual as well, that would help a lot, but I've not found any.
Hope it helps, good luck!
Hi,
The wiki covers the NCalc basics:
https://github.com/SHWotever/SimHub/wiki/NCalc-scripting---Language-basics
https://github.com/SHWotever/SimHub/wiki/NCalc-scripting---Introduction
https://github.com/SHWotever/SimHub/wiki/NCalc-scripting
You can also see all the available properties and functions listed within SimHub binding editor.
You could use the timesincelastevent(eventname) function for your stint timer.
The events are listed in the controls and event screen (new mapping).
The name must include the plugin name.
timesincelastevent('DataCorePlugin.PitOut')
If you want to freeze it at pit entry, you'll have to use JS instead of NCalc as NCalc won't let you declare variables to store values in a single formula.
https://github.com/SHWotever/SimHub/wiki/Javascript-Formula-Engine
This formula should do it. Here root["stoppedTimer"] will stop updating at pit entry:
if( root["stoppedTimer"]==null){
root["stoppedTimer"] = 0;
}
var liveTimer = timesincelastevent('DataCorePlugin.PitOut');
if( !$prop('IsInPitLane')){
root["stoppedTimer"] = liveTimer;
}
return root["stoppedTimer"];
I've been working on dashes roughly three years ago and took a break for a very long time causing me to forget a lot of my "tricks". I want to thank you Romainrob, I've learned A LOT just by studying your code this past week. And honestly, the timing of this thread couldn't have been posted better at any other time. I have gotten acquainted to using JRT timing and "building" my own dashboard using their text based css interface. But the one thing that has spoiled me is stint info. I plan on switching back to SimHub full time because I really love making my dash unique - especially in VR. Looks like I need to really study Java so I'm better prepared for the future.
@romainrob This is epic Rob, thank you so much. Time to do some reading!