Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   CoD Multiplayer (http://forum.fulqrumpublishing.com/forumdisplay.php?f=192)
-   -   IL-2 Server Master v1.0 (http://forum.fulqrumpublishing.com/showthread.php?t=23275)

TheEnlightenedFlorist 07-29-2011 08:55 AM

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

adonys 07-29-2011 09:14 AM

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..

TheEnlightenedFlorist 07-29-2011 10:33 AM

Technically, yes. IL-2 is obviously using it to reference the external dll before compiling the script. How that is done is beyond me.

CaptainDoggles 07-29-2011 05:15 PM

Some parsers will read the first line, even if it's commented. Example: unix shell scripts.

adonys 07-30-2011 07:30 AM

obviously they must have a parser which seems to look even after // chars for special words (as $reference).

41Sqn_Banks 07-30-2011 07:33 AM

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.

wildwillie 09-12-2011 12:43 PM

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

wildwillie 09-14-2011 12:51 AM

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


All times are GMT. The time now is 06:13 PM.

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