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 08-08-2011, 05:39 AM
fearlessfrog fearlessfrog is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default Grabbing the hWnd and keyboard etc

Have any of you guys played around with trying to have some sort of input into a running mission script, i.e. user key-presses or external window handle?

I'm thinking as a WPF app it should be possible to register for OnKey events or GetKeyState and the like but I've not yet tried it. It should be possible to get the window handle and then go from there as I imagine the AMission class wouldn't get any of that naturally.

Anyone tried this or have any luck with this type of thing already?
Reply With Quote
  #2  
Old 08-08-2011, 07:28 AM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

I tried to read "command" (something like "!hello" typed in by a player) from the log file. However it seems like the log file is only written when the game is closed.
Reply With Quote
  #3  
Old 08-08-2011, 07:39 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

As far as I know a log file is written with a very short delay at least on a dedi server.

Quote:
Originally Posted by fearlessfrog View Post
Have any of you guys played around with trying to have some sort of input into a running mission script, i.e. user key-presses or external window handle?
Small_Bee or Geniok at sukhoi.ru mentioned that grabbing key presses is probably possible if a dll is downloaded from server to client together with a mission. No one did this yet as far as i know.

Last edited by Ataros; 08-08-2011 at 07:45 AM.
Reply With Quote
  #4  
Old 08-08-2011, 08:52 AM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Quote:
Originally Posted by Ataros View Post
As far as I know a log file is written with a very short delay at least on a dedi server.
Ok I will check this. Would make sense as the dedicated server is not supposed to be closed that often.
Reply With Quote
  #5  
Old 08-08-2011, 09:01 AM
adonys adonys is offline
Approved Member
 
Join Date: Apr 2010
Posts: 850
Default

Even if it is not written duing the mission, MG must have at least some pointer to the filebuffer in which is stored.. Most probably they should also have some LastLineAdded funtion.. You should ask Narvy on sukhoi forum.
Reply With Quote
  #6  
Old 08-08-2011, 04:50 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

I managed to register a method to the Chat event of the GameDef class. However I don't think it's possible to access GameDef from the mission script.

I can do this however from within my addin.
Reply With Quote
  #7  
Old 08-08-2011, 05:17 PM
fearlessfrog fearlessfrog is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default

Quote:
Originally Posted by 41Sqn_Banks View Post
I managed to register a method to the Chat event of the GameDef class. However I don't think it's possible to access GameDef from the mission script.

I can do this however from within my addin.
Hmm, perhaps I should be doing an add-in then. My original question was really for just single player functionality, and I thought putting it in a mission script would be the way to go.

I see you implemented an Add-In interface in your campaign stuff Banks - does that also run while a mission is being played, i.e. I could hook into the Chat event while a mission is playing if I write an Add-in?

Thanks for your comments/help btw
Reply With Quote
  #8  
Old 08-08-2011, 06:33 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Yes the chat is captured during the mission.

http://code.google.com/p/il2dce/sour...IL2DCE/Core.cs

Code:
        public Core(GameDef game)
        {
            _game = game;

            Game.EventChat += new GameDef.Chat(Game_EventChat);

Code:
        void Game_EventChat(IPlayer from, string msg)
        {
            if(msg.Contains("!hello"))
            {
                Game.gpLogServer(new Player[] { from }, "Hello World!", null);
            }
        }
Here is how the GameDef is given to the Core. This is also the entry point for the addin.
http://code.google.com/p/il2dce/sour.../GameSingle.cs
Code:
public GameSingle(GameSingleIterface game)
                : base(game)
            {
                core = new Core(this);
            }
To load the addin you need to have a .xml file:
http://code.google.com/p/il2dce/sour...GameSingle.xml
Reply With Quote
  #9  
Old 08-08-2011, 06:59 PM
fearlessfrog fearlessfrog is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default

Great - thank you!
Reply With Quote
  #10  
Old 08-14-2011, 08:12 PM
fearlessfrog fearlessfrog is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default

One related question to this is has anyone found out anything regarding an Add-in interface that works without having to define a single player mission or campaign setup pages?

Banks - it seems the GameDef reference is only passed down into the Add-In once a whole campaign set is defined, say a new 'Single Player' menu entry (i.e. an entry in the XML config to the right assembly etc).

So if I wanted to let people just use my add-in then I have to either:

- Define some custom pages to go pick quick missions that exist. Is there anyway to reuse what's been defined in Play.QuickMiss() as that seems to return ContentControls rather than a Page implementation?

- Define a complete WPF custom page that allows a mission file to be picked and then loads the Mission?

- Some other type of Client Add-In that gives me the GameDef reference but is included in all type so Campaign/Missions?

Anyone got any ideas of this?

Last edited by fearlessfrog; 08-14-2011 at 08:38 PM.
Reply With Quote
Reply


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 03:35 PM.


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