Lowy-♥ Posted June 16, 2024 (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? Edited June 16, 2024 by Lowy-♥ 0 Quote Share this post Link to post
boris Posted June 16, 2024 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. 1 Quote Share this post Link to post
Lowy-♥ Posted June 16, 2024 (edited) 1 hour ago, boris said: FixedMul(35.0, 4.405) >> 16 well ">> 16;" always outputs a semicolon error for me 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 June 16, 2024 by Lowy-♥ 0 Quote Share this post Link to post
Gez Posted June 16, 2024 (edited) 10 minutes ago, Lowy-♥ said: well ">> 16;" always outputs a semicolon error for me 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 June 16, 2024 by Gez 1 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.