Jump to content

Tics Divided by Milliseconds


Recommended Posts

Posted (edited)

I am working with a file that needs to be executed on VERY specific time: 4.405 seconds

So i am struggling on doing that, because doing Delay (35*4); works, but i cant insert the milliseconds there in any way, i tried with 4,405 (which of course does not works because it takes it like a parameter) and also with 4.405 which probably doesnt work because it takes it like "four and four hundred five thousandths," i also tried with only 4405 which also does not work, it probably takes it the same way as the other one

 

i also think on just do it with the tics, which well, its the same thing but with more maths... so how do i insert milliseconds?

 

image.png.fd61279c6cbf8cf02d8241c2e6bc089e.png

Edited by Lowy-♥

Share this post


Link to post
12 minutes ago, Lowy-♥ said:

how do i insert milliseconds?

 

You can't, at least not with that precision. The absolutely smallest duration is 1 tic, which is roughly 28.571 milliseconds. The closest you can get is 4.4 seconds, which are 154 tics.

 

Also you can't do fractional number multiplication like that in ACS. Doom uses fixed point numbers to represent fractional parts. So you'd have to do

 

FixedMul(35.0, 4.405) >> 16

 

i.e. do a fixed point multiplication, then bit shift to the right by 16 to get back to an integer number. Which results in 154.

Share this post


Link to post
Posted (edited)
1 hour ago, boris said:

FixedMul(35.0, 4.405) >> 16

well ">> 16;" always outputs a semicolon error for me

image.png.d943e0e54402dbdb338cc9cf707f67f8.png 

image.png.2bd35acdc1ecb4a828e633e319a69ef1.png

but at least for now i am gonna stay with the 154 tics, 0.005 milliseconds is no diference at all

how you did the maths for that result? i am awful at math lol

 

Edited by Lowy-♥

Share this post


Link to post
Posted (edited)
10 minutes ago, Lowy-♥ said:

well ">> 16;" always outputs a semicolon error for me

image.png.d943e0e54402dbdb338cc9cf707f67f8.png 

image.png.2bd35acdc1ecb4a828e633e319a69ef1.png

but at least for now i am gonna stay with the 154 tics, 0.005 milliseconds is no diference at all

how you did the maths for that result? i am awful at math lol

 

You get a semicolon error there because you put the >> 16 outside of the function call.

 

It should have been

Delay(FixedMul(35.0, 4.405)>>16);
10 minutes ago, Lowy-♥ said:

how you did the maths for that result? i am awful at math lol

Desired duration divided by timeslice length gives you how many timeslices you need:

4.405 / (1/35) = 154.175

 

Also note that dividing by 1/x is tantamount to multiplying by x, so you could also have done:

4.405 * 35

Edited by Gez

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...