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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-02-2012, 11:45 AM
salmo salmo is offline
Approved Member
 
Join Date: Mar 2011
Posts: 632
Default Execute code from string?

I know the code below fails, but can anyone provide a solution to concatonate the eDamage string & execute the randomly selected aircraft.hitNamed(part.NamedDamageTypes. line?

Code:
string[] eDamage = 
        {
            "ElecBatteryFailure",
            "ElecGeneratorFailure",
            "ElecIlluminationFailure",
            "ElecMasterCompassFailure",
            "ElecPrimaryFailure",
            "ElecPriNavigationFailure",
            "ElecSecNavigationFailure",
            "ElecSecondaryFailure",
            "ElecTransceiverFailure",
            "ElecWeaponryFailure"
	    };

            // ---- Electrics failures ----=
            string e = "aircraft.hitNamed(part.NamedDamageTypes." + eDamage[random.Next(eDamage.GetLowerBound(0), eDamage.GetUpperBound(0) + 1)] + ");";
            //Console.WriteLine(e);
            //Process.Start(e);
            // string e conatins the c# code, now how to 'execute' the string as a command?
        }
__________________
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; 04-02-2012 at 11:48 AM.
Reply With Quote
 

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:05 AM.


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