Rule to tell your current place

This tutorial show you how to create a Rule that will tell your current place triggered using Keyboard shortcut RightAlt+K.

If you have installed a voice recognition engine (previous tutorial), you will be able to ask your current position by saying "Position".

Define a new Keyboard Shortcut
Open the Spotter.ini file, and search for the [Keyboard] section.

Increment the "Keyboard.Shortcut.count" and add the RightAlt+K shortcut.

For example, if the Spotter.ini look like this: [Keyboard] Keyboard.Shortcut.count=1 Keyboard.Shortcut.1.modifier.virtualCode=165    // right alt Keyboard.Shortcut.1.key.virtualCode=74          // J key To add a new RightAlt+K shortcut uption this part to: [Keyboard] Keyboard.Shortcut.count=2 Keyboard.Shortcut.1.modifier.virtualCode=165    // right alt Keyboard.Shortcut.1.key.virtualCode=74          // J key Keyboard.Shortcut.2.modifier.virtualCode=165    // right alt Keyboard.Shortcut.2.key.virtualCode=75          // K key As a reminder, the vitualCode come from this website

Create the new Rule
Now, you will create the Rule to allow the Spotter to tell your place when the new shortcut is pressed.

Open the Rule file defined in the Spotter.ini under the Rules.file parameter of the [Default] section.

Increment the existing number of rules, by updating the Rules.count parameter of the [Main] section and create the new [Rule.] section where  is the new index (count)

For example, if the rule file look like: [Main] Events.file=DefaultEvents.ini Rules.count=27 Update rule count to 28 and add a new [Rule.28] section [Main] Events.file=DefaultEvents.ini Rules.count=28 As we want the new Rule.28 only triggered on the new shortcut, set the Trigger to Manual and the Trigger.Shortcut to the new shortcut index. Moreover, as there is no event that match our needs, we need to create a new Event, named "MyCurrentPlace" in this tutorial. Finally, we need to give the current driver place as input of the event.

Here the new [Rule.28] section [Rule.28] Trigger=Manual Trigger.Shortcut=2 Event=MyCurrentPlace Input1=Place

Create the new Event
Open the Events file defined in the Rules file under the Events.file parameter of the [Main] section.

As in the Spotter, an event exist to tell your place when this one changed at S3 compare to your last place at S3, we will use this event as template.

Here the event used as template: Event=MyPlace {  Detail=3 Spacing=0.0 Priority=0.3 Probability=1.0 TTL=20.0 Break=0.25 // Repeat until duration ends Repeat=Off Duration=0.0 // Volume can be set before individual Files if necessary Volume=1.0 Variable=Session { Value=5,13 { Variable=Input2 {        Value=(>0) { Variable=Substract,Input1,Input2 {            Value=(<0) { Variable=Input1 {                Value=(>=1,<=999) { File=you_are.wav PlayEvent=PlaceNum }              }             }             Value=(>0) { Variable=Input1 {                Value=(>=1,<=999) { File=you_are.wav PlayEvent=PlaceNum }              }             }           }         }       }     }   } } As this event is called with Input1=PlaceAtS3 Input2=PlaceAtS3LastLap This event have the following algorythm: As you can see, for a response base on a user triggered rule, we don't need to check the session and we don't need to test that the last place and the current place is different.
 * If the session is Qualifying1-4, Warmup, Race1-4
 * if PlaceAtS3LastLap is initialized
 * If place < last place
 * Now use Input1 as nearest variable (usefull for PlayEvent command)
 * Check the place is between 1 and 999 (as the PlaceNum event support from 1 to 999 only)
 * play sound "Your are at position..."
 * PlayEvent "PlaceNum" (this is the event who really tell place given in Input1)
 * If place > last place
 * Now use Input1 as nearest variable (usefull for PlayEvent command)
 * Check the place is between 1 and 999 (as the PlaceNum event support from 1 to 999 only)
 * play sound "Your are at position..."
 * PlayEvent "PlaceNum" (this is the event who really tell place given in Input1)

So the new event "MyCurrentPlace" will be: Event=MyCurrentPlace {  Detail=3 Spacing=0.0 Priority=1           // set to max priority as it is triggered manually Probability=1.0 TTL=20.0 Break=0.25 // Repeat until duration ends Repeat=Off Duration=0.0 // Volume can be set before individual Files if necessary Volume=1.0 Variable=Input1 {    Value=(>=1,<=999) { File=you_are.wav PlayEvent=PlaceNum }  } }