Hello. I would like to ask how I can make simhub play a sound when the car doesn't move from the start or the pits for a certain amount of time. It would be like a warning to tell the driver to move.
I have found this in Simhub / Available properties: DataCorePlugin.GameData.NewData.IsInPitSince
Now, what can I do with that?
Do I need to write something like
[DataCorePlugin.GameData.NewData.IsInPitSince] >10
"Target": "AudioControlPlugin.Play_mysound"
I am trying with the Ncal tester and the pit time counter works, but not the function to start the sound.
But where do I write it? The event window doesn't let write that. Maybe in a file?
Hi, the function to trigger an action from a formula is triggeraction(actionName).
Here is an example:
if( isincreasing(1, blink(secondsbeeps, 500, 1))
,triggeraction( 'AudioControlPlugin.Play_beep-07') ,'')
If you'd rather use the event mapper, you can add custom events to the list with a NCalc script.
https://github.com/SHWotever/SimHub/wiki/NCalc-scripting
Your code must be wrong. If I paste it in the Ncalc tester it reports "Expression error: function not found. Parameter name: triggeraction"
@elaphe It works on my end. You should ear the beeping when pasting the formula in the tester
triggeraction was added to SimHub nearly 2 years ago now.
What version of SimHub are you running?
Finally, after copying some examples and doing many tests I have been able to make this work. I have created a .ini file in the ncalcscripts folder with this content:
[ExportEvent]
name='LetsGoMrDriver'
trigger=if([DataCorePlugin.GameData.NewData.IsInPitSince]>20,1,0)
Then I created an event, selected the external event as source and the audio control plugin as target.