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 > CoD Multiplayer

CoD Multiplayer Everything about multiplayer in IL-2 CoD

Reply
 
Thread Tools Display Modes
  #31  
Old 07-29-2011, 08:55 AM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

It works. It looks in the root directory of IL-2. Maybe it would make more sense if it were:

//$reference parts/ServerMaster/IL2ServerMasterLibrary.dll
Reply With Quote
  #32  
Old 07-29-2011, 09:14 AM
adonys adonys is offline
Approved Member
 
Join Date: Apr 2010
Posts: 850
Default

but isn't that line actually a comment? or you just meant it as a comment to show the path were it will look for the dll..
Reply With Quote
  #33  
Old 07-29-2011, 10:33 AM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

Technically, yes. IL-2 is obviously using it to reference the external dll before compiling the script. How that is done is beyond me.
Reply With Quote
  #34  
Old 07-29-2011, 05:15 PM
CaptainDoggles's Avatar
CaptainDoggles CaptainDoggles is offline
Approved Member
 
Join Date: Jun 2011
Posts: 1,198
Default

Some parsers will read the first line, even if it's commented. Example: unix shell scripts.
Reply With Quote
  #35  
Old 07-30-2011, 07:30 AM
adonys adonys is offline
Approved Member
 
Join Date: Apr 2010
Posts: 850
Default

obviously they must have a parser which seems to look even after // chars for special words (as $reference).
Reply With Quote
  #36  
Old 07-30-2011, 07:33 AM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

There is another keyword that can be placed within the mission script:
Code:
//$debug
This will give you more information if exceptions occure. I think the main purpose of the //$reference keyword is to allow the creation of a own base class for your mission. Without the reference the .dll that contains the base class is not loaded.

Last edited by 41Sqn_Banks; 07-30-2011 at 07:35 AM.
Reply With Quote
  #37  
Old 09-12-2011, 12:43 PM
wildwillie wildwillie is offline
Approved Member
 
Join Date: Aug 2010
Posts: 111
Default

Tried this yesterday and it worked when I used my client to run as a server. Was able to send the "Test" command and got Received back.

When I tested this on our Dedicated server it did not work. (Dedicated server uses Win 2008 Server OS (64bit)

The 1st problem I found and modified to work for me was in the code where you create the socket. New code I had to change the ipAddress.AddressFamily piece.

Code:
              // Create a TCP/IP socket.
                Socket client = new Socket(ipAddress.AddressFamily,
                    SocketType.Stream, ProtocolType.Tcp);
Now on the server it loads the server master and creates the port, but I do not get a "received" message back when I issue a command and I do not see any errors.

Any Ideas ?

WildWillie
Reply With Quote
  #38  
Old 09-14-2011, 12:51 AM
wildwillie wildwillie is offline
Approved Member
 
Join Date: Aug 2010
Posts: 111
Default

Quote:
Also, it turns out there's a much easier way to reference the dll than using reflection.


Code:
//$reference IL2ServerMasterLibrary.dll
using IL2ServerMasterLibrary;Then...


Code:
ServerMaster master = new ServerMaster("pass", 27340);
string[] command = master.popCommand();
If using the above syntax in my mission script do I still need the OnBattleStarted/OnBattleStoped methods to declare everything ?

I would think no by your example, but I get the following error in my server log when the above code is used instead of the "Reflections" stuff.

Code:
=================================================
System.Exception: c:\Users\willie\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\main.cs(24,24): error CS0236: A field initializer cannot reference the non-static field, method, or property 'Mission.master'

   at elUgjJyQSTyUw5ACkC5.DycAUsynQYrfCiQcD9l.7xH8TZeymA7(String , Boolean , Boolean )
   at elUgjJyQSTyUw5ACkC5.DycAUsynQYrfCiQcD9l.o9e0xJrppZOs9Hdpx1qr(Object , Boolean , Boolean )
   at elUgjJyQSTyUw5ACkC5.DycAUsynQYrfCiQcD9l.gKP8TsfiPQn(String )
   at elUgjJyQSTyUw5ACkC5.DycAUsynQYrfCiQcD9l.x9MliMrTRjjBgALGw0Ov(Object )
   at elUgjJyQSTyUw5ACkC5.DycAUsynQYrfCiQcD9l.yJF8aliJrV2(String , Int32 )
=================================================

=================================================
System.Exception: c:\Users\willie\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\main.cs(24,24): error CS0236: A field initializer cannot reference the non-static field, method, or property 'Mission.master'

   at elUgjJyQSTyUw5ACkC5.DycAUsynQYrfCiQcD9l.yJF8aliJrV2(String , Int32 )
   at LxsOQ2lMvdvAq5WtJux.8x1kchl77DHyoNyKcFY.3utIWKxLiN(vASj0IJYAK5O3O5NAlk )
=================================================

Here is the 1st part of my mission script:

Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
//$reference IL2ServerMasterLibrary.dll
using IL2ServerMasterLibrary;

public class Mission : AMission
{


//      MethodInfo mi;
//      Type classType;
//      object obj;


    int LastMissionLoaded = 0;

    double initTime;

    ServerMaster master = new ServerMaster("xyz", 27340);
    string[] command = master.popCommand();  

//    public override void OnBattleStarted()
//      {
//        base.OnBattleStarted();
//
//        try
//        {
//            //Load the new DLL from the specified path and set the current method to popCommand().
//            Assembly a = null;
//            a = Assembly.LoadFrom("missions/IL2ServerMasterLibrary.dll");
//            classType = a.GetType("IL2ServerMasterLibrary.ServerMaster");
//            obj = Activator.CreateInstance(classType, new object[] { "dover", 11000 }); 
//                     //First argument is the password, second is port number.
//            mi = classType.GetMethod("popCommand");
//            GamePlay.gpLogServer(new Player[] { GamePlay.gpPlayer() }, " - Server Master Loaded", null);
//
//        }
//        catch (Exception e)
//        {
//            GamePlay.gpLogServer(new Player[] { GamePlay.gpPlayer() }, "Could not load Server Master. :(" + e.Message + ")", null);
//        }
//    }


//    public override void OnBattleStoped()
//    {
//        base.OnBattleStoped();
//
//        //Set method to Stop(). Stop the DLL.
//        mi = classType.GetMethod("Stop");
//        mi.Invoke(obj, null);
//      }
Any Ideas ?

WildWillie
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 04:55 PM.


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