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 10-04-2011, 05:37 PM
=XIII=Wedge =XIII=Wedge is offline
Approved Member
 
Join Date: Jan 2010
Posts: 21
Default Using LINQ with script writing

Hi all,

I was writing a small script the other day and decided to use a little LINQ.

However, when I loaded the mission in the FMB and ran compile in the scripts window I got a compiler warning about not recognising LINQ.

I was under the impression that the game was compiled with .NET 4.0, so this has got me stumped.

Any ideas?

P.S - I wanted to create an assembly with some common routines rather than having to add them to every script. Have the same problem here as I do not know where to put the assembly for it to be referenced by the script file.

Haven't tried the GAC, but wanted to avoid it if possible.
Reply With Quote
  #2  
Old 10-04-2011, 05:44 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

you must set a reference to System.Linq.dll the before loading the namespaces, but may be you need others dlls too.
Example:

//$reference System.Data.dll
//$reference System.Linq.dll
//$reference System.XML.dll
using System;
using System.Data;
using System.Linq;
Reply With Quote
  #3  
Old 10-04-2011, 05:51 PM
=XIII=Wedge =XIII=Wedge is offline
Approved Member
 
Join Date: Jan 2010
Posts: 21
Default

Thanks for the reply Kodiak.

I had added the using statements and the project compile successfully in VS2010 Express.

However, it would not compile in FMB when right clicking 'Compile' on the scripting window.
Reply With Quote
  #4  
Old 10-04-2011, 05:58 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

There is no need to "compile" it in FMB.

Start your mission and then open the console, if there no errors like missing assembly etc. the script should work.
Reply With Quote
  #5  
Old 10-04-2011, 06:49 PM
=XIII=Wedge =XIII=Wedge is offline
Approved Member
 
Join Date: Jan 2010
Posts: 21
Default

The FMB crashes when I load the mission. It is working fine if I re-write the LINQ statement with a foreach loop.
Reply With Quote
  #6  
Old 10-04-2011, 07:38 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Hm had no problem with linq, but i only tried a little test script.
Reply With Quote
  #7  
Old 10-04-2011, 08:47 PM
=XIII=Wedge =XIII=Wedge is offline
Approved Member
 
Join Date: Jan 2010
Posts: 21
Default

Very strange,

I know that unused using statments are disregarded by the compiler in C#.

Did you write any LINQ statements or just add the reference?
Reply With Quote
  #8  
Old 10-05-2011, 04:49 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Only a little Linq statement.

Sometimes it helps if you delete the cache of CoD.

Can you attach a sample script of your code so i can test it on my computer?
Reply With Quote
  #9  
Old 07-16-2012, 06:02 AM
II./JG1_Krupinski II./JG1_Krupinski is offline
Approved Member
 
Join Date: Oct 2007
Posts: 86
Default

NecroThread for posterity:

To use Linq, it's in System.Core.dll so use

//$reference System.Core.dll
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 10:51 PM.


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