Jump to content

C# function that will return OS.time


Lineaxe

Recommended Posts

request for a C# function that will return OS.time to be added into DCS core

 

 

 

Hi , I have a somewhat crucial need for a C# function to be added into DCS . This is so that I can access it without having to desanitize the MissionScripting.lua file . C# code such as the following could easily be added in and shouldn't cause any problems with any XNA code already present in the project.

 

 

using System;

namespace funcOS

{

class AccessOSFunctions

{

public long getOSTimetoLong()

{

 

OSLongTime= new Date().getTime();

return OSLongTime;

}

public long setLongtoOSTime()

{

// not used

}

}

 

} :dunno:


Edited by Lineaxe
Link to comment
Share on other sites

Dear ED,

 

 

Please take time out from all the myriad features, bugs, and optimisations you're working on to write me some dedicated code in an otherwise unsupported language because it's super-critical to some undisclosed personal project I'm working on.

 

 

Sincerely,

 

 

Some bloke

i7-7700K @ 4.9Ghz | 16Gb DDR4 @ 3200Mhz | MSI Z270 Gaming M7 | MSI GeForce GTX 1080ti Gaming X | Win 10 Home | Thrustmaster Warthog | MFG Crosswind pedals | Oculus Rift S

Link to comment
Share on other sites

  • 2 weeks later...

Well I must point out that any code needed I put the code is already in the above post. I simplified any operations needed for any intergration into the DCS engine . C# is not obscure at all, and it is the language used to write XNA code (which I imagine would be used to create the DCS world). Anyhow, it's the one that I have used to create 3d world engines with. It's the one that Microsoft uses for Directx related code and it's XBOX 1 code is written with XNA. So I created a function that can should hook into existing code in the DCS engine.

Now , I know that many programmers are quite busy with upgrades, bug traces & fixes, and the like , so I did just put it in the wishlist and made it as easy as possible for someone to implement.

Heh, as I go back over my 40 years of programming , I think of all the times , in all the programming languages, I somehow go back to calling that time function. Right up from to old days of C , before C++ . I think I even called it up in Pascal back then. I wouldn't call a function as common as that 'obscure' at all , However, it is pretty obscure , as far as the DCS project is concerned I must admit :)

 

The project that the code is being used with, I posted elsewhere here, It's a Random Generator, based off some research I had done online at some LUA programming websites. I threw a coupla extra options into the original function , however,throughout the function os:time , is required. This generator is being used right inside my Chop_u series of missions.

Well, implemeting the above code , somehow is on my wishlist anyhow. I am sure that tons of great features are being worked on at the moment and I eagerly await all patches !

I can always just remind everyone who downloads these missions to manually copy a modified copy of the missionscripting.lua file over after the upgrades( as it gets written over).


Edited by Lineaxe
Link to comment
Share on other sites

Uhh, C++ , eh , now I know why the C# code is so obscure to DCS...Joke's on me I think ... Heheh, oh well .I have been doing some coding in C++ for Arduino, Ubuntu & Andriod (linux) systems. I did check out some OPENGL stuff. WebGL Looks promising . Directx is such a large API . Must be huge now, I haven't looked at it in quite a while. Now I wonder what kind of tools have been developed to help created 3d worlds using C++ these days. I have always nicknamed C++ the 'hell' language. But multiple inheritance, I guess , comes at a cost... Brrr....must be the language of the devil I tell ya . Anyhow, I still dabble away in it here and there :)


Edited by Lineaxe
Link to comment
Share on other sites

It's a Random Generator, based off some research I had done online at some LUA programming websites. I threw a coupla extra options into the original function , however,throughout the function os:time , is required. This generator is being used right inside my Chop_u series of missions.

Building your own random number generator is a bad idea. It will break the track file replayability as your mission scripting code will behave differently when you fly the mission and when you replay the track.

 

 

I bet, there are solutions for this, besides the various randomizing methods that the mission editor itself already provides. You might want to research the DCS mission scripting in LUA capabilities in general and the existing scripting frameworks, for example using MIST.

Link to comment
Share on other sites

Hi, thanks for the reply. Well, I have noticed, even without using a random generator, the tracks are unplayable since they use numbers to represent Attacking units and so on. So, when I tried to hit replay, it didn't know what to do. It was suggested I get TacView Advanced so I can watch the Tracks . Now , I see your point about potential danger in using different random generators , especially for time related events. The only time I have used the generator to create a time span offset, I have give the software some leeway on when It actually schedules something based on the number. So far in my code, It doesn't matter if there is a bit of fluctuation. I am willing to accept it for the benefit of lots of randomization options. I like to think a bit of C++ code added into the DCS core might open up that option a bit for people to use :) Now ,that's quite an engine they have and they already have tons of stuff to work on. So, I will just work around it by updating missionscripting.lua as needed.

Link to comment
Share on other sites

  • 4 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...