PDA

View Full Version : Ticks?



SoW Reddog
Oct-17-2014, 14:48
So, there I was pretty sure of my own calcs but things weren't working quite as I expected.

So, how many ticks are in a minute using Time.tickcounter() ?

ATAG_Colander
Oct-17-2014, 14:56
Isn't there a "ticklen()" that gives you that info?

SoW Reddog
Oct-17-2014, 18:29
dunno. I'd been working under the assumption there were 32*60 ticks in a minute, which comes at around 1920 or something, but I've just read somewhere there's 1800... That might explain why mission lengths aren't quite what I thought they would be...

ATAG_Colander
Oct-17-2014, 22:58
Again, tickLen will give you the number you are looking for but, if you want it even easier, TicksToSecs should help you.

ATAG_Freya
Apr-05-2015, 20:11
sry - post deleted - figured it out....it was right infront of my face..

No.401_Wolverine
Apr-07-2015, 22:45
Didn't see your post before you deleted it Freya, but I thought I'd just pop this in here in case it's relevant to anyone. We've always used Stopwatch to time our missions and they've always been pretty much bang on the second for time finishing and restarting.

ATAG_Freya
Apr-08-2015, 00:41
You didn't miss much, just me failing horribly at math. All I can come up with is 1 min = 2000 ticks.

Stopwatch? Never heard of it, is it a script thing? I would like to know more about that!

:salute:

Salmo
Apr-08-2015, 16:47
You didn't miss much, just me failing horribly at math. All I can come up with is 1 min = 2000 ticks.

Stopwatch? Never heard of it, is it a script thing? I would like to know more about that!

:salute:

The C# stopwatch class does exactly what you'd think it does. It creates a new stopwatch that can the started, stopped & reset & you can read the time elapsed from it in minutes, seconds & milliseconds.

http://www.dotnetperls.com/stopwatch

ATAG_Freya
Jun-18-2016, 12:23
The C# stopwatch class does exactly what you'd think it does. It creates a new stopwatch that can the started, stopped & reset & you can read the time elapsed from it in minutes, seconds & milliseconds.

http://www.dotnetperls.com/stopwatch

Is there a way to display a running time, or current state of the timer while using stopwatch? Everything I have tried so far the game doesn't seem to like the term 'elapsed'. It also doesn't like 'get()' - I need a way to display the time left between calling an AI raid (ie. how long till the timer resets again). I hashed out the string.format thing I was trying earlier, not sure I need that. Snippet of code I'm working with so far..



private bool BomberMissionInProgress = false;
private string BomberMission = string.Empty;
Stopwatch BomberMissionTimer = new Stopwatch();

(snip)


if (menuItemIndex == 1)

//string BomberMissionTimer = String.Format("{0:00}:{1:00}:{2:00}", ts.Hours, ts.Minutes, ts.Seconds);

{
if (player.Army() == 1)
{
if (BomberMissionInProgress)
{
GamePlay.gpLogServer(null, "Bomber Command ready in: " + BomberMissionTimer.Get());
SetMainMenu(player);
}
else
{
BomberMission = BOMBERMISSIONS_FILE_PATH + "Raider4.mis";

(snip)

if (BomberMissionTimer.Elapsed.TotalSeconds >= 2400) // 3600 RESETS BOMBER COMMAND EVERY HOUR
{
BomberMissionInProgress = false;
//BomberTarget = "";
//BomberBrief = "";
BomberMission = "";
BomberMissionTimer.Reset();
sendScreenMessageTo(1, "Aircraft are on standby and await mission orders.", null);
sendScreenMessageTo(2, "Aircraft are on standby and await mission orders.", null);
}



Also If I use the line:

GamePlay.gpLogServer(null, "Bomber Command ready in: " + BomberMissionTimer, new object[] { }));

It says in-game "Bomber command ready in: System.diagnostics.stopwatch"

OR something similar... but that won't do either!

TWC_Fatal_Error
Jun-18-2016, 14:44
we use

TICKS_PER_MINUTE=1986

//empirically, based on a timeout test. This is approximate & varies slightly.

SoW Reddog
Jun-18-2016, 15:04
I use 200 per second, but as pointed out, Ticks vary. They're close enough.

Nephilim
Jun-18-2016, 19:16
Hmmm... That gives me a thought...

Lets say You take Your physical server machine and throw into big fat jumbo jet, and let it fly at 30k feet for few years without major stops.

How will Tick function look between server and client then?
Can we achieve something with sending CLOD into past?
Will that be possible with TF ver.10?

ATAG_Freya
Jun-19-2016, 16:50
Solved my timer thinger:


{
if (player.Army() == 1)
{

if (BomberMissionInProgress)
{
TimeSpan ts = BomberMissionTimer.Elapsed;
string elapsedTime = String.Format("{0:00}",ts.Minutes);
GamePlay.gpLogServer(null, "Bombers were called " + elapsedTime + " minutes ago, and can be called again after 40 minutes", new object[] { });
SetMainMenu(player);
}
else
{
BomberMission = BOMBERMISSIONS_FILE_PATH + "Raider4.mis";
BomberMissionInProgress = true;
GamePlay.gpPostMissionLoad(BomberMission);
sendScreenMessageTo(1, "Attention! 8X Wellington will be at Deal in 10min - angels 20 - target: Marquise west", null);
sendScreenMessageTo(2, "Achtung! Enemy Raid Reported. All squadrons on Alert - keep checking Radar", null);
BomberMissionTimer.Start();
SetMainMenu(player);
}

There are probably better ways to do it, like the form of a countdown, but this will work well enough for today.

Does anyone know how to make the - sendScreenMessageTo - part last for a longer time, maybe like 10-12 seconds?