Player Countdown - Format

Hi Torben,
I cannot seem to replicate my previous timer formats using the current snapshot release. The Ramp timer only shows the furthest ramp and I cannot set it to .z so it only shows 1/10th sec - it always defaults to 3 decimal places :frowning: The “Show only nearest Ramp” option seems to have no effect.

Seems that FormatDateTime cannot output 1/10th seconds, only milliseconds. I will have to introduce my own FormatDateTime function then :-/ (I still like the flexibility of specifying your own format, rather than using the former “show in seconds”, “truncate” etc. options).

I will also investigate the ramp issue.

Torben’s right, the 1/10th second problem is a shortcoming in Delphi itself, not the mAirList code!

Also .z in a FormatDateTime string does NOT do what Charlie thinks. For example, .500 formatted with .z will still display as .500; but .005 formatted with .z will display as .5 (geddit?!?!!???!?!). :smiley:

Maybe the easiest solution would be introduce a new mAirList-only formatting string ‘code’ of zz which means ‘leftmost character of the formatted zzz result (aka: tenths of a second, truncated from the mS value).’ That should be reasonably easy for Torben to code for (by using two FormatDateTime calls, or using a single call substituting zzz for zz; then suitably ‘hacking’ the returned result before passing it on to the caller).

Just my suggestion … ;D

BFN
CAD

Instead of counting the z’s, I’d better introduce new variables, say “u” for 1/10th and “v” for 1/100th of a second. Here’s my proposed solution:

function MyFormatDateTime(Formatting: string; DateTime: TDateTime): string;
begin
  Formatting := StringReplace(Formatting, 'u', Copy(FormatDateTime('zzz', DateTime), 1, 1), [rfReplaceAll]);
  Formatting := StringReplace(Formatting, 'v', Copy(FormatDateTime('zzz', DateTime), 1, 2), [rfReplaceAll]);
  Result := FormatDateTime(Formatting, DateTime);
end;

It’s important to perform the substitution before the call to FormatDateTime, as the latter might insert any of these characters into the text (“Sunday”).

Would that be ok?

Personally, I’d just like them to be similar to the Player timer - Specifically the “Show time in seconds (instead of 1/10th sec)” option :wink: I appreciate that the progress bars offer greater resolution than 1sec but it’d be “nice” if the GUI objects can be configured to mimic the Player/Cartwall countdowns… IMHO, 3 decimal places is a bit “big” and a little too accurate (unless you’re one of Cad’s scripts!). Didn’t know about zzz vs z - never used it but it’s sending me to sleep just thinking about it!

Any practical solution (that keeps everybody happy) would be welcomed :wink:

The solution mentioned above seems to work. I’ll upload a new snapshot tommorrow.

Build 516 is ready, introducing the “u” and “v” variables mentioned above. Let me know if it works.

Torben: nice work! (Any thoughts yet on the ‘shrinking’ duration at EOF in PFL Player? :wink: )

Charlie: it’s because people like Herr Doktor and myself not only aren’t rendered comatose by (for example) the difference between zzz vs. z, but also know, care, and fret about it; that all the software that you really like (such as mAirList) ‘just works.’ ;D

BFN
CAD

I can’t get the Intro Timer to display either a u or a v… What I mean is, it DOES display the u or v and not the .x decimal value - the Time Remaining counter is OK. Also, the Intro still does not show all ramps in the ramp1/ramp2/ramp3 format. I’m using Intro: ss.u or nn:ss.u and Remaining: nn:ss.u

Cad - Understand perfectly, appreciate that a hell of a lot of work goes in “behind the scenes” to make certain features work how we want :wink:

[quote=“Torben, post:4, topic:5201”]Here’s my proposed solution:

function MyFormatDateTime(Formatting: string; DateTime: TDateTime): string; begin Formatting := StringReplace(Formatting, 'u', Copy(FormatDateTime('zzz', DateTime), 1, 1), [rfReplaceAll]); Formatting := StringReplace(Formatting, 'v', Copy(FormatDateTime('zzz', DateTime), 1, 2), [rfReplaceAll]); Result := FormatDateTime(Formatting, DateTime); end; [/quote]

Er … I understand the idea, but …

I think you need two Booleans to store whether or not the original Formatting contains ‘.u’ and ‘.v’ (respectively); assign the FormatDateTime result to a new temporary string instead of to Result; then use those Booleans to perform the correct right-end truncation before setting Result to the (possibly truncated) temp. string. Don’t you? :wink: Otherwise, you’ll just get milliseconds in the Result, unless I’m missing something glaringly obvious?

BFN
CAD