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 05-16-2012, 08:34 AM
moggel moggel is offline
Approved Member
 
Join Date: Mar 2011
Posts: 70
Default How to obtain in-game time?

I'm still experimenting with scripting stuff for the sim and I've come across a problem I haven't found a solution for: How do I get the in-game time?

I've experimented with Mission.Time but it seems all values are just offsets from the instant when the mission started. There's the concept of "real" time but that also seems to be an offset and unless I can figure out the mission start time it's of no use (at least for what I'm trying to do).

I had an idea that maybe I could read the start time from the main mission file by loading it as a section file but there doesn't seem to be a way to figure out the file name for it.

Has anyone figured any of this out?
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate
Reply With Quote
  #2  
Old 05-16-2012, 09:50 AM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Yes reading the section file would be possible. You have to specify the name and path of the file though.
Reply With Quote
  #3  
Old 05-16-2012, 03:20 PM
moggel moggel is offline
Approved Member
 
Join Date: Mar 2011
Posts: 70
Default

Quote:
Originally Posted by 41Sqn_Banks View Post
Yes reading the section file would be possible. You have to specify the name and path of the file though.
That's the problem: I dunno which .mis file represents the current (main) mission. Is there a way to resolve that?
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate
Reply With Quote
  #4  
Old 05-16-2012, 09:32 PM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

I'm trying to solve a similar(maybe the same objective) with real time at the moment to be able to reset a mission without reloading it. As you mention mostly we are dealing with Time.current() from the start of mission to cycle or run timers. It is not in game realtime.

In old IL2 it was tod (time of day) and you could just send a new time of day to the server or host by console or script.

I have found the following, I'm not sure if they are the same as Time.current()
ITime()
GamePlay.gpTime()
GamePlay.gpTime().current()

But up to now I haven't been able to parse them to a "reporting" hud or serverlog to see what they report. They wont convert to a string, int or double. (I think I'm just doing it wrong at present due to not knowing syntax).
Once we know what it is by type, in theory we should be able to alter gpTime()

Another way I have been considering is to create a section file of the "TIME" set out in the mis file under [MAIN] (I already do this with a number of other things). However this may not work as new sub missions ignore sections of sub missions including the Time value.
Because of this battle may need to be stopped to invoke a time change. In which case just reloading the main mission with an altered TIME may work, the catch is the CS itself, you can't run 2 occurances of the same CS and if you destroy the CS you are in you can't restart unless you monitor externally, like with clod commander....but this is clumsy just to reset the time!

I'm sure it is realtively simple once we identify the syntax and gameplay code to work with.

Might need help from the experienced coders on this one.
Reply With Quote
  #5  
Old 05-16-2012, 09:43 PM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

This (needs checking), may work as to load a 6am time value by section file.

Code:
GamePlay.gpPostMissionLoad(CreateNewTime()); // loader placed in statement to trigger when required(inside timetick section)

// section file to load, sits outside timetick section
    internal ISectionFile CreateNewTime()
    {
        ISectionFile newtime = GamePlay.gpCreateSectionFile();
        newtime.add("MAIN", "TIME 6", "");
        return newtime;
    }
Reply With Quote
  #6  
Old 05-17-2012, 01:26 PM
moggel moggel is offline
Approved Member
 
Join Date: Mar 2011
Posts: 70
Default

Quote:
Originally Posted by Smokeynz View Post
I'm trying to solve a similar(maybe the same objective) with real time at the moment to be able to reset a mission without reloading it. As you mention mostly we are dealing with Time.current() from the start of mission to cycle or run timers. It is not in game realtime.

In old IL2 it was tod (time of day) and you could just send a new time of day to the server or host by console or script.

I have found the following, I'm not sure if they are the same as Time.current()
ITime()
GamePlay.gpTime()
GamePlay.gpTime().current()

But up to now I haven't been able to parse them to a "reporting" hud or serverlog to see what they report. They wont convert to a string, int or double. (I think I'm just doing it wrong at present due to not knowing syntax).
Once we know what it is by type, in theory we should be able to alter gpTime()

Another way I have been considering is to create a section file of the "TIME" set out in the mis file under [MAIN] (I already do this with a number of other things). However this may not work as new sub missions ignore sections of sub missions including the Time value.
Because of this battle may need to be stopped to invoke a time change. In which case just reloading the main mission with an altered TIME may work, the catch is the CS itself, you can't run 2 occurances of the same CS and if you destroy the CS you are in you can't restart unless you monitor externally, like with clod commander....but this is clumsy just to reset the time!

I'm sure it is realtively simple once we identify the syntax and gameplay code to work with.

Might need help from the experienced coders on this one.
In my little experiment I've been reading those values. They are all of type 'double' and reflects the number of seconds elapsed since the mission started. So far I haven't been able to find any way to figure out the in-game time (what the pilot reads from the dashboard clock). If only there was a way to get the mission start time it would be a simple matter of adding the GamePlay.gpTime() value to the start time to get the in-game time. But I have not been able to find a way to obtain the mission start time and that's where I'm stuck at the moment.
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate
Reply With Quote
  #7  
Old 05-17-2012, 07:06 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by moggel View Post
That's the problem: I dunno which .mis file represents the current (main) mission.
Why? Time is set in the main mission file IIRC.
Reply With Quote
  #8  
Old 05-17-2012, 09:16 PM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

Ataros, I see 2 reasons for needing ingame "realtime" as opposed to mission run time.

1. If you want to create timelapse over shorter mission time.
For example: Each hour step forward 3 hours.

So during game play of 2~3hours, you could have morning, mid day, dusk and evening.

2. If you want to reset the day, which is actually how clod works.
In theory you can run 24/7 on one "map" layout, which means either night missions(many can't be arsed with that) or being able to reset the time to mission start or some other time.

Btw I tested tod by entering tod into the console, "Shift-Tab" type tod, enter and the console reports the game real time, as IL2 used to.
But I can't find tod in clod, only the Time(), ITime().

During the IL2 series tod shifted between accessable to alter and not accessable to alter between releases.

So ingame realtime is there as tod(via console), but probably not accessable or alterable by game script.

btw I tested my little code snipet above to enter a new section time and this fails as I predicted.

moggal, another and relatively simple way to establish ingame realtime is to gather the mission time by streamreader, then add runtime to the mission start time, there by infering the realtime.

There is probably a way to check "tod" directly, just don't know the syntax to interigate the host/server for tod.
Reply With Quote
  #9  
Old 05-18-2012, 08:42 AM
moggel moggel is offline
Approved Member
 
Join Date: Mar 2011
Posts: 70
Default

Quote:
Originally Posted by Ataros View Post
Why? Time is set in the main mission file IIRC.
Because the stuff I'm writing needs to be built to work with any mission. I'm building a simulated "Fighter Command" for MP use and the solution needs to be working with whatever mission the server operator is setting up. The reason I want in-game time is because I would like to simulate the British Sector Clock, color coding all reports as they where back in the day.
__________________
Core i7 3930K @ 4.8GHz; 16Gb DDR3 (Vengeance); nVidia GTX580; OS disk: 150Gb 10000rpm; SIM disk: 300Gb 10000rpm; Windows 7 x64 Ultimate
Reply With Quote
  #10  
Old 05-18-2012, 11:34 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

C# should be able to read file names from a given folder I think but I may be wrong.

There was a mission posted here called Mission Loader that can read mission filenames. Banks' COOP lobby can do this too IIRC.
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 06:01 PM.


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