|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi(gh)!
For generating a time display for my current attempt at a Satisfactory
1.0 speedrun, I use the following code:
#declare hours=div(clock,90000);
#declare minutes=mod(div(clock,1500),60);
#declare seconds=mod(div(clock,25),60);
#declare centiseconds=mod(clock,25)*4;
and the text object is built like:
concat(str(hours,-2,0),":",str(minutes,-2,0),"'",str(seconds,-2,0),",",str(centiseconds,-2,0)),0.001,0
But whenever the clock value is divisible by 25 without remainder, I get
"100" instead of "00" for the centiseconds part of the timestamp. Why?
See you in Khyberspace!
Yadgar
--
VBI BENE, IBI BACTRIA!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Am 21.09.2024 um 04:21 schrieb Jörg "Yadgar" Bleimann:
> Hi(gh)!
>
> For generating a time display for my current attempt at a Satisfactory
> 1.0 speedrun, I use the following code:
>
> #declare hours=div(clock,90000);
> #declare minutes=mod(div(clock,1500),60);
> #declare seconds=mod(div(clock,25),60);
> #declare centiseconds=mod(clock,25)*4;
>
> and the text object is built like:
>
>
concat(str(hours,-2,0),":",str(minutes,-2,0),"'",str(seconds,-2,0),",",str(centiseconds,-2,0)),0.001,0
>
> But whenever the clock value is divisible by 25 without remainder, I get
> "100" instead of "00" for the centiseconds part of the timestamp. Why?
>
> See you in Khyberspace!
>
> Yadgar
>
Hi Yadgar,
mod() seems to affect only the integer part of a float value. E.g.,
mod(24.88248825,25)=24.88248825 and mod(25.00250053,25)=0.00250053.
The value of 100 comes from the rounding by str(value,-2,0). E.g.,
str(24.88248825*4,2,0)=str(99.52995300,-2,0)=100, as the fractional part
is greater than 0.5.
Maybe
#declare centiseconds=floor(mod(clock,25)*4);
will serve you better.
Regards
Michael
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi(gh)!
On 21.09.24 08:33, MichaelJF wrote:
> mod() seems to affect only the integer part of a float value. E.g.,
> mod(24.88248825,25)=24.88248825 and mod(25.00250053,25)=0.00250053.
>
> The value of 100 comes from the rounding by str(value,-2,0). E.g.,
> str(24.88248825*4,2,0)=str(99.52995300,-2,0)=100, as the fractional part
> is greater than 0.5.
>
> Maybe
>
> #declare centiseconds=floor(mod(clock,25)*4);
>
> will serve you better.
When I tried this, I got centiseconds from 03 to 99... also not
satisfactory (pun intended!), as I wanted 04 to 00 (or 00 to 96). Then I
looked up my command line... and noticed that +kf and +kff were not
identical (+kf154115 but, accidentally, +kff145155)! So there was a tiny
but growing fractional remainder at each frame number divisible by 25! I
corrected this, and now it works perfect even without floor()!
Nevertheless, thank you for your suggestion!
See you in Khyberspace!
Yadgar
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi(gh)!
On 21.09.24 15:42, Jörg "Yadgar" Bleimann wrote:
> (+kf154115 but, accidentally, +kff145155)!
Whoops, wrong... the erroneous +kff value was 154155, not 145155!
Excuse me, I caught cold and thus my IQ became temporarily two-digit...
See you in Khyberspace!
Yadgar
--
VBI BENE, IBI BACTRIA!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|