Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2012, 05:07 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default Write to Launcher console process?

I'm trying to write to the MP Launcher console from a sub-mission script. The code below works in the main mission script ie. It will write the connection status in the console window, but it fails where I put the same script in the sub-mission script.cs. I thought I might have to construct a process-writer to write from the sub-mission to the Launcher console, but I can't get this to work. Help appeciated.

code removed by author

I've tried this but often come up with a "System.Array does not contain a definition for StandardInput"
inputWriter = process.StandardInput; // Create the console writer (fails)
inputWriter.WriteLine("... Connected to MP game console failed.");
//process.WriteLine("... Connected to MP game console failed.");
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE

Last edited by salmo; 10-18-2012 at 09:15 AM.
Reply With Quote
  #2  
Old 06-06-2012, 06:46 PM
ATAG_Colander ATAG_Colander is offline
Approved Member
 
Join Date: Jan 2012
Posts: 214
Default

I haven't tried it but you might want to try AttachConsole(-1).
Reply With Quote
  #3  
Old 06-07-2012, 05:38 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Quote:
Originally Posted by ATAG_Colander View Post
I haven't tried it but you might want to try AttachConsole(-1).
Looks like you need a reference to the System.Runtime.InteropServices & the kernel32.dll file which contains the AttachConsole routine. This code-set has no compiler errors but doesn't write to the parent console either ...
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE

Last edited by salmo; 10-18-2012 at 09:16 AM.
Reply With Quote
  #4  
Old 06-15-2012, 09:55 AM
moggel moggel is offline
Approved Member
 
Join Date: Mar 2011
Posts: 70
Default

Quote:
Originally Posted by salmo View Post
Looks like you need a reference to the System.Runtime.InteropServices & the kernel32.dll file which contains the AttachConsole routine. This code-set has no compiler errors but doesn't write to the parent console either ...

Code:
    using System;
    using maddox.game;
    using maddox.game.world;
    using System.Collections;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.IO;
    using System.Security.Cryptography;
    using maddox.GP;
    using System.Text.RegularExpressions;
    using System.Runtime.InteropServices;

public class Mission : AMission
{
    [DllImport("kernel32.dll", SetLastError = true)]    // use the kernel32.dll file routines
    static extern bool AttachConsole(uint dwProcessId); // use attachconsole from the kernel32.dll file
    const uint ATTACH_PARENT_PROCESS = 0x0ffffffff;     // default value if not specifing a process ID

    public override void OnBattleStarted()
    #region start variables/timers/listeners
    {
        base.OnBattleStarted();
        MissionNumberListener = -1; //listen to events from all missions.
        ConnectToLauncherConsole();
    }
    #endregion

    public void ConnectToLauncherConsole()
    {
       AttachConsole(System.Diagnostics.Process.GetProcessesByName("Launcher")[0].Id); // no error but no cannection either
       Console.WriteLine("... Connected to MP launcher console OK.");

       AttachConsole(ATTACH_PARENT_PROCESS);  // no error but no cannection either
       Console.WriteLine("... Connected to MP launcher console OK.");

    }
tried setting up a custom console for the sub-mission processes, and again, no compile errors but no console or output

Code:
    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        MissionNumberListener = -1; //listen to events from all missions.      

        AllocConsole();
        Console.Title = "MyTitle";
        Console.CursorVisible = true;
        Console.OpenStandardInput(256);
        Console.OpenStandardOutput(256);
        Console.WriteLine("Hello, World!");
        // The official music of Dot Net Perls.
        for (int i = 37; i <= 32767; i += 200)
        {
            Console.Beep(i, 100);
        }
   }
Not sure why you want to do this in the first place but if all you need is to get text to show in the MP console window you just need to log it the old fashioned way (call GamePlay.gpLogServer()). Example: gpLogServer(null, "Hello World!"); will print "Hello World" in the MP console window.
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate
Reply With Quote
  #5  
Old 06-15-2012, 10:01 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

On Dedicated Server you can use GamePlay.gpPlayer() to write to the Console, on Dedi gpPlayer() is the server itself.
null sends the message to all, with the gpPlayer only the server (Console) gets the message.
Reply With Quote
  #6  
Old 08-04-2012, 09:19 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Quote:
Originally Posted by FG28_Kodiak View Post
On Dedicated Server you can use GamePlay.gpPlayer() to write to the Console, on Dedi gpPlayer() is the server itself.
null sends the message to all, with the gpPlayer only the server (Console) gets the message.
This fails Kodiak? Help please
GamePlay.gpLogServer(GamePlay.gpPlayer(), "... Connected to MP launcher console OK.", null);
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE
Reply With Quote
  #7  
Old 08-04-2012, 01:05 PM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

does this help?

Code:
    private void sendChatMessageTo(int army, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if (GamePlay.gpPlayer().Army() == army || army == -1)
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }
__________________
__________________
Win7, 64bit Ultra
Asus P8P67Pro MB
Intel i7-2600K
Coursair 16GB (4x 4GB), DDR3-1600MHz
Gainward Nvidia 580GTX 3GB DDR5
850-Watt Modular Power Supply
WIN7 and COD on Gskill SSD 240GB
40" Panasonic LCD
TrackIR5 +
Thrustmaster Warthog stick, throttle & pedals
Reply With Quote
  #8  
Old 08-04-2012, 01:28 PM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

Sorry to say it doesn't Wolf. I'm trying to write script-log information to the Launcher console from a sub-mission script, not write to the game screen chat window.
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE
Reply With Quote
  #9  
Old 08-04-2012, 02:53 PM
podvoxx podvoxx is offline
Approved Member
 
Join Date: Feb 2010
Posts: 190
Default

Quote:
Originally Posted by salmo View Post
Sorry to say it doesn't Wolf. I'm trying to write script-log information to the Launcher console from a sub-mission script, not write to the game screen chat window.
http://www.sukhoi.ru/forum/showthrea...65#post1875465

Ask about this naryv on Sukhoi.ru, he know how do this.
Reply With Quote
  #10  
Old 08-13-2012, 02:14 PM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default

I've tried using the 'Sending server console commands from script' example below, but the code below throws a "missing reference required error" at the line in the sub-mission script where SendServerCommand function is called
__________________
When one engine fails on a two engine bomber, you will always have enough power left to get to the scene of the crash.

Get the latest COD Team Fusion patch info HERE

Last edited by salmo; 10-18-2012 at 09:16 AM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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