Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   EventChat (http://forum.fulqrumpublishing.com/showthread.php?t=34797)

41Sqn_Banks 10-07-2012 01:11 AM

EventChat
 
Sometimes it would be useful to react on chat messages in your mission script (e.g. to list the remaining targets). I found the solution at sukhoi.ru, there is a hidden flag in the conf.ini that enables this.

IMPORTANT:
You have to add the following line to your conf.ini or confs.ini file:
Code:

[rts]
scriptAppDomain=0

Without that you get a System.Runtime.Serialization.SerializationExceptio n.

This is the code for the mission:

Code:

public override void OnBattleStarted()
{
    base.OnBattleStarted();

    if (GamePlay is GameDef)
    {
        (GamePlay as GameDef).EventChat += new GameDef.Chat(Mission_EventChat);
    }
}

void Mission_EventChat(IPlayer from, string msg)
{
    // msg contains the chat message.

    // Example: This code causes the server to repeat the message from the player.
    if (GamePlay is GameDef)
    {
        (GamePlay as GameDef).gameInterface.CmdExec("chat " + msg);
    }   
}

Happy coding :)

FG28_Kodiak 10-07-2012 08:24 AM

Nice find, thanks. Sometimes i wish my russian would be better. But only with "Dawei Dawei" :rolleyes:

41Sqn_Banks 10-07-2012 10:36 AM

Now I only need a way to write a chat message to a player (which is shown in the dogfight menu chat window).

Any ideas?

salmo 10-07-2012 11:05 AM

Nice find Banks. Makes you wonder what other functionality is hidden.

41Sqn_Banks 10-07-2012 12:00 PM

This allows the server to write chat messages:
Code:

string msg = "Hello World!";
if (GamePlay is GameDef)
{
    (GamePlay as GameDef).gameInterface.CmdExec("chat " + msg);
}

Is there a way to send a chat message only to a specific player?


All times are GMT. The time now is 11:33 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.