SimHub icon indicating copy to clipboard operation
SimHub copied to clipboard

[Feature request] DashStudio: PluginSdk plugins to be able to define custom NCalc/Js functions

Open fixfactory opened this issue 8 months ago • 0 comments

Is your feature request related to a problem? Please describe. It would be simpler and more performant if plugins made with the PluginSdk could define their own custom NCalc/Js functions to be used in DashStudio formulas. This would allow formulas to pass parameters to the functions and get the specified data accordingly.

For example, a plugin could create new leaderboard functions that return new data fields:

  • bo2_drivercountryflag(raceposition) Returns for the race position the driver's country flag name.
  • bo2_driverjokerlaps(raceposition) Returns for the race position the driver's amount of joker laps completed.
  • etc.

Describe the solution you'd like Add an API, for example: IPluginExtensions.AddFunction<T>(string functionName, Function function) Functions would probably need to be prefixed with pluginname_ not to clash with official SimHub functions.

Describe alternatives you've considered The alternative is to create a custom property for each possible index in the leaderboard, and have helper js functions that return the correct property for the specified raceposition parameter.

Additional context

Image

fixfactory avatar Aug 28 '25 19:08 fixfactory