How to add Audio message if neutral or enemy hits local?

Hello, i want to build a simple script thats give me a audio warning if a neutral or enemy hits local. But my Programming skills are to low to do it. Hope some one can help me.

I have found some scripts here in forum, but that doenst work for me.

boolIsNeutralOrEnemy(IChatParticipantEntry participantEntry) =>
   !(participantEntry?.FlagIcon?.Any(flagIcon =>
     new { “Pilot is in your (fleet|corporation)” }
     .Any(goodStandingText =>
        flagIcon?.HintText?.RegexMatchSuccessIgnoreCase(goodStandingText) ?? false)) ?? false);
while(true)
{

var    chatLocal =
     Sanderling.MemoryMeasurementParsed?.Value?.WindowChatChannel
     ?.FirstOrDefault(windowChat => windowChat?.Caption?.RegexMatchSuccessIgnoreCase(“local”) ?? false);

Host.Log(chatLocal?.ParticipantView?.Entry?.Count());
     if(chatLocal?.ParticipantView?.Entry?.Any(IsNeutralOrEnemy) ?? true)    // will be true if (null == chatLocal) 
 {

System.Media.SoundPlayer simpleSound = new System.Media.SoundPlayer(@“C:Users airiesaudioalarma.wav”);
              simpleSound.Play();
     
 }

//    wait for four seconds before repeating.
    Host.Delay(4000);
    //    make sure new measurement will be taken.
    Sanderling.InvalidateMeasurement();

}

Hello Fairies,

the following script works for me to play a sound:

new System.Media.SoundPlayer(@"c:\Windows\Media\chimes.wav").Play();

You will have to make sure you have a suitable sound file at the given location.

When we have the sound working, we can continue with the rest.

Thx, this work fine for me.

Here is the full script, dont know how its work, but its work and i am happy with it

	Sanderling.Parse.IMemoryMeasurement Measurement => Sanderling?.MemoryMeasurementParsed?.Value;
var    chatLocal =
     Sanderling.MemoryMeasurementParsed?.Value?.WindowChatChannel
     ?.FirstOrDefault(windowChat => windowChat?.Caption?.RegexMatchSuccessIgnoreCase("local") ?? false);
bool hostileOrNeutralsInLocal => 1 != chatLocal?.ParticipantView?.Entry?.Count(IsNeutralOrEnemy); 
bool IsNeutralOrEnemy(IChatParticipantEntry participantEntry) =>
   !(participantEntry?.FlagIcon?.Any(flagIcon =>
     new[] { "Pilot is in your (fleet|corporation)" }
     .Any(goodStandingText =>
        flagIcon?.HintText?.RegexMatchSuccessIgnoreCase(goodStandingText) ?? false)) ?? false);
while(true)
{
var    chatLocal =
     Sanderling.MemoryMeasurementParsed?.Value?.WindowChatChannel
     ?.FirstOrDefault(windowChat => windowChat?.Caption?.RegexMatchSuccessIgnoreCase("local") ?? false);


 if(chatLocal?.ParticipantView?.Entry?.Count(IsNeutralOrEnemy) > 1)     
 {
Host.Log(hostileOrNeutralsInLocal);
Host.Log(chatLocal?.ParticipantView?.Entry?.Count(IsNeutralOrEnemy));
System.Media.SoundPlayer simpleSound = new System.Media.SoundPlayer(@"C:\Users\airies\Downloads\alarma.wav");
 	simpleSound.Play();
 }
Host.Delay(4000);

Sanderling.InvalidateMeasurement();
}

2 Likes

Thank you, that might be helpful for others.

Hello trying to use this script getting this error:

Failed:

System.Media.SoundPlayer simpleSound = new System.Media.SoundPlayer(@“‪F:\Downloads\script\tada.wav”);

That file is 100% at that location. Anyone got this working?

Sound is working for me, but you have to be sure you are using .wav file !
For some reason though… It alarms for blue also.
Not just if there is a neut / enemy

In the code you posted I can see the quote characters around the string literal are incompatible with C#. This is why you get a compilation error. To fix it use this code instead:

System.Media.SoundPlayer simpleSound = new System.Media.SoundPlayer(@"F:\Downloads\script\tada.wav");

The code only makes it not bleep for fleet/corp members.

This code is ALMOST great. Sadly it keeps beeping for the same person once their in local. Ideally it should be once or twice only per new local entrant.

Thanks, that worked.

I guess some people might not want the message to appear when the tooltip for the chat participant is Pilot is in your alliance.

If this applies to you, have a look at the following change:
https://github.com/botengine-de/A-Bot/commit/ee14d4d1a37fa6bd84096ec0a08bc520f3474d78#diff-ed2ab61f70d403fc81b894f182b30cc8

1 Like

Could you possible also add “good/excellent” standing in it ?

Hi guys
Not been here for long.
@Viir Is it still possible to use this script : ) ?

Welcome back Ivar! :wave:

Maybe it is still possible, but I would not use it because I found a better way in the meantime. I made an example to demonstrate how to add an audio message, in a way that is better integrated with the current EVE Online bot framework:

To hear it in action, run it with this command:

botengine run-bot "https://github.com/Viir/bots/blob/e1c4dac983b8fdb597942ba02025b1d450ee8932/implement/applications/eve-online/eve-online-intel-tool"

This bot watches the local chat and plays a sound if there are neutral or enemy pilots.

For general information about the botengine command, see the guide at https://to.botlab.org/guide/how-to-run-a-bot

Hello Viir :wave:

I tried to run the bot, followed your instructions, but I’m not able to get it to work. I installed the BotEngine and opened cmd, copied this inside the window

C:\Users\BT\Desktop\Bot\BotEngine.exe run “bots/Bot.elm at e1c4dac983b8fdb597942ba02025b1d450ee8932 · Viir/bots · GitHub

and it tells me that there is a problem with the app source, “Seems like that app is not compatible with this version of the engine.”

Do you have any solution?

Best regards

K4mpfSock3

Welcome @K4mpfSock3!

Yes, the app code from that link is not compatible with the newest version of the engine for Windows.

I updated the local watch app code to work with the newest version of the engine. You can run it like this:

botengine  run  "https://github.com/Viir/bots/blob/8df52d373315bd5aa41a9d4a0ceef6ea6aa16bff/implement/applications/eve-online/eve-online-local-watch/src/Bot.elm"

The catalog entry is here: https://catalog.botengine.org/F337C2D7A83547ACC36122FC5F4B805A042AC8F3336F83F4DA2ED567F2CC26EC

Ok, this worked. Thank you!
But is there a way that the bot is running longer than 15 minutes?

Sure, to make the bot run longer than 15 minutes, add the --online-session option like so:

botengine  run  --online-session  "https://github.com/Viir/bots/blob/8df52d373315bd5aa41a9d4a0ceef6ea6aa16bff/implement/applications/eve-online/eve-online-local-watch/src/Bot.elm"

More about online sessions: https://to.botengine.org/guide/online-session

Hello,

I encounter this error after following all the steps do you have any idea?

Thank you
Flo ^^

App f43fa60ab6… in session ‘’ (‘2021-01-23T10-32-25-14b17d’) is running. Press SHIFT + CTRL + ALT keys to pause the app.
run v2020-12-08 failed with exception: System.Exception: Failed to process app event.
—> System.Exception: App reported decode error: Failed to deserialize event: Json.Decode.oneOf failed in the following 4 ways:

(1) Problem with the given value:

{
        "timeInMilliseconds": 0,
        "eventAtTime": {
            "AppSettingsChangedEvent": [
                ""
            ]
        }
    }

Expecting an OBJECT with a field named `ArrivedAtTime`

(2) Problem with the given value:

{
        "timeInMilliseconds": 0,
        "eventAtTime": {
            "AppSettingsChangedEvent": [
                ""
            ]
        }
    }

Expecting an OBJECT with a field named `SetBotConfiguration`

(3) Problem with the given value:

{
        "timeInMilliseconds": 0,
        "eventAtTime": {
            "AppSettingsChangedEvent": [
                ""
            ]
        }
    }

Expecting an OBJECT with a field named `CompletedTask`

(4) Problem with the given value:

{
        "timeInMilliseconds": 0,
        "eventAtTime": {
            "AppSettingsChangedEvent": [
                ""
            ]
        }
    }

Expecting an OBJECT with a field named `SetSessionTimeLimit`

at BotEngine.Windows.Console.RunAppSession.<>c__DisplayClass6_0.g__processSerializedAppEvent|17(String serializedEvent) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\RunAppSession.cs:line 707
— End of inner exception stack trace —
at BotEngine.Windows.Console.RunAppSession.<>c__DisplayClass6_0.g__processSerializedAppEvent|17(String serializedEvent) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\RunAppSession.cs:line 749
at BotEngine.Windows.Console.RunAppSession.Run(TreeComponent appCodeTree, Func2 getFileFromHashSHA256, String appProcessRecordingDirectory, Action1 logEntry, Action1 addSessionLogEntry, String appSettings, String sessionCustomName, AppSourceStructure appSource, String keyToStartOnlineSession, IEnumerable1 sessionLengthLimits, IImmutableList1 pauseAppKeys, IImmutableList1 statusDisplayAdditionLines, RunSimulation simulation, InterProcessCommunicationState interProcessCommunication) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\RunAppSession.cs:line 815
at BotEngine.Windows.Console.BotEngine.runAppWithOptionsFromCommandLine(String appSourceInputAddress, String appSettings, String pauseAppKeysString, Boolean onlineSession, String keyToStartOnlineSession, String sessionLengthLimitArgumentString, RunSimulation simulation, Nullable`1 detailedSessionRecording) in D:\a\dev-of-botengine\dev-of-botengine\implement\client\windows-console\BotEngine.Windows.Console\Program.cs:line 713
[2021-01-23T10-32-33] v2020-12-08 Session ended.

There was a change in the interface to the host in December. That is why the newest engine version does not run the code linked above.

I uploaded a new intel tool to work with the newest engine version here: bots/implement/applications/eve-online/eve-online-local-watch at 050f25447f23ad7fb6f2335b23fb83653d273c04 · Viir/bots · GitHub

You can run it like this:

botengine  run  https://github.com/Viir/bots/tree/050f25447f23ad7fb6f2335b23fb83653d273c04/implement/applications/eve-online/eve-online-local-watch

Hello I use the bot. It works too. It shows me the number of users in the local in the Bott window. But he always gives the alarm and says 3 members with bad standing.
And the bot stops after a few minutes. With the message Session ended

This Version use
https://botcatalog.org/679bcfc28f69e3e057be6e91b501b8656c4bc95e78004c4047e6f5e2921b73da

Here a ingame picture: