Home   Help Search Login Register  

Author Topic: how does flashpoint know the date?  (Read 933 times)

0 Members and 1 Guest are viewing this topic.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
how does flashpoint know the date?
« on: 13 Aug 2005, 16:03:43 »
fire up a mission and there it is. the time and day and month are defined in the mission.sqm, but if flashpoint displays the info, how does it extract it?

more to the point, is there a way of doing it with script?

DBR_ONIX

  • Guest
Re:how does flashpoint know the date?
« Reply #1 on: 13 Aug 2005, 21:40:23 »
missionStart in MP returns the time the mission starts, and you can turn this into skip-time easily enough (I think I stil have the code for it, I posted it on the forums to I'm sure)
But thats only MP, the only single-player way I know of is though FWatch, which returns the system time
- Ben

bored_onion

  • Guest
Re:how does flashpoint know the date?
« Reply #2 on: 14 Aug 2005, 00:47:21 »
sounds like the sort of thing that would be involved in the description.ext rather than in direct scripting/editing. maybe the config has the answer.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:how does flashpoint know the date?
« Reply #3 on: 14 Aug 2005, 09:06:01 »
config? damn. that's something i know nothing about... i've defined many dialogs, added custom sounds and suchlike, but that's as far as i've taken the description.ext...

anyone else?

bored_onion

  • Guest
Re:how does flashpoint know the date?
« Reply #4 on: 14 Aug 2005, 10:31:58 »
ok had a (brief) poke around in some of tuts for the config ( :o) but couldn't find anything. - it really was a stab in the dark

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:how does flashpoint know the date?
« Reply #5 on: 14 Aug 2005, 11:22:23 »
dont fully understand the reasoning for the question

If setting the time and date in the mission.sqm, then it will be an internal variable stored within ofp hard coding

the missionstart command would i assume run some ofp hard code function which will query the pc's clock time

there is nothing in the resource,.cpp or main config

as far as i know, nobody has been able to de-binarize the context.bin but i doubt that will have any content do do with this

what exactly is it that you are trying to achieve

At a guess, do you want to display the real time in a hint box etc throughout the mission

maybe a combination of "missionstart" and "time" comparison and then set the array elements after doing some maths would do it


eg
;; _Z = start time
;; _M = time since mission started
;;_R = _Z + _R
#INIT
_Zyear = missionstart select 0
_Zmonth = missionstart select 1
_Zday = missionstart select 2
_Zhour = missionstart select 3
_Zminute= missionstart select 4

#START
~1
_Msecs = time
_Mhour = _Msecs/60/60
_Mhour = _Mhour - (_Mhour mod 1)
_Rhour = _zhour + _Mhour
if(_rhour >= 24)then{_rday = _rday + (_Rhour/24)-_rhour mod 1)}
;;;lots of more code and maths but you get the generral idea
the above maths is probably incorrect,
(just wrote this on the fly, done no testing)


Z_time = Format["<<< Zulu Hour\n>>>>%1 - %2 - %3 at %4 : %5 Hrs",_zday, _zmonth, _zyear, _zhour, _zminute]

R_time = Format["<<< Time into mission\n>>>>%1 - %2 - %3 at %4 : %5 Hrs",_Rday, _Rmonth, _Ryear, _Rhour, _Rminute]

goto "START"



General idea, you take the missionstart time, do some maths to return for instance possibly any skiptime values using the "daytime" query or if no skiptime is used, then the "time" query
check to see that no more than 24hrs has passed and if it has add 1 day to ther _rday etc, same for hours, minutes etc

in the end you get a "realtime" printout in a hint format of what the actual time is on the server or client PC etc as computed since missionstart


IS THAT THE SORT OF THING YOU MEAN ?????
« Last Edit: 14 Aug 2005, 11:48:18 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:how does flashpoint know the date?
« Reply #6 on: 14 Aug 2005, 13:13:05 »
this is for an SP mission, therefore missionstart will always return [0,0,0,0,0,0].

the reason i want to know what the date is, is so that i can calculate when the sun sets, and therefore when it gets dark, as trying to interrogate streetlights will always return "auto" whether it's day or night.

i want to know when it gets dark so that i know which of two dialogs to display - daytime or nighttime.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:how does flashpoint know the date?
« Reply #7 on: 14 Aug 2005, 23:51:37 »
ok, well specifically for your mission, you can query the daytime

eg
If((daytime < 6.2)or(daytime > 18.3))then{hint "Its dark"}else{hint "Its light"}

by creating a test mission on your selected island and setting that test mission to the same date as your mission but setting the time to midnight, which is "daytime == 0"
and then running skiptime commands, you will be able to precisely calculate the daytime value for sunset and sunrise and then amend the above code accordingly

the skiptime values will be the same daytime values if you skiptime from midnight
« Last Edit: 14 Aug 2005, 23:51:59 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123