Page 1 of 1

Equation to convert value

Posted: Sun Apr 24, 2022 2:43 am
by yaim904
How to convert the value of the effect in the corresponding time??

Code: Select all

[ 'construction-robotics' ] = {
	[ 'type' ] = 'technology',
	[ 'name' ] = 'construction-robotics',
	[ 'icon_size' ] = 256,
	[ 'icon_mipmaps' ] = 4,
	[ 'icon' ] = '__base__/graphics/technology/construction-robotics.png',
	[ 'effects' ] = {
		[ 5 ] = {
			[ 'type' ] = 'ghost-time-to-live',
			[ 'modifier' ] = 36288000,
		},
	},
	[ 'prerequisites' ] = {
		[ 1 ] = 'robotics',
	},
	[ 'unit' ] = {
		[ 'count' ] = 100,
		[ 'ingredients' ] = {
			[ 1 ] = {
				[ 1 ] = 'automation-science-pack',
				[ 2 ] = 1,
			},
			[ 2 ] = {
				[ 1 ] = 'logistic-science-pack',
				[ 2 ] = 1,
			},
			[ 3 ] = {
				[ 1 ] = 'chemical-science-pack',
				[ 2 ] = 1,
			},
		},
		[ 'time' ] = 30,
	},
	[ 'order' ] = 'c-k-a',
},
The time in the prototype is

Code: Select all

[ 5 ] = {
	[ 'type' ] = 'ghost-time-to-live',
	[ 'modifier' ] = 36288000,
},
But in the game the value is 168h
The question is: What equation is used to calculate this time?

Re: Equation to convert value

Posted: Sun Apr 24, 2022 3:16 am
by coderpatsy
60 updates per second * 60 seconds per minute * 60 minutes per hour * 168 hours = 36288000

Re: Equation to convert value

Posted: Sun Apr 24, 2022 8:57 am
by yaim904
coderpatsy wrote: Sun Apr 24, 2022 3:16 am
your calculations are wrong

Code: Select all

36288000 / ( 60 ^ 3 ) = 216000

Re: Equation to convert value

Posted: Sun Apr 24, 2022 9:17 am
by mmmPI
yaim904 wrote: Sun Apr 24, 2022 2:43 am
The time in the prototype is
[ 'modifier' ] = 36288000,
But in the game the value is 168h
The question is: What equation is used to calculate this time?
(36288000/60)/3600=168

60 tick in 1 second, 3600 second in 1 hour

tick = game update
60 ups = 60 tick per second.

Re: Equation to convert value

Posted: Sun Apr 24, 2022 9:55 am
by yaim904
Now I understand
Thank you very much

Re: Equation to convert value

Posted: Sun Apr 24, 2022 1:12 pm
by FuryoftheStars
yaim904 wrote: Sun Apr 24, 2022 8:57 am
coderpatsy wrote: Sun Apr 24, 2022 3:16 am
your calculations are wrong

Code: Select all

36288000 / ( 60 ^ 3 ) = 216000
You might want to run that through a calculator again. 36288000 / ( 60 ^ 3 ) is 168.

Re: Equation to convert value

Posted: Sun Apr 24, 2022 5:36 pm
by yaim904
FuryoftheStars wrote: Sun Apr 24, 2022 1:12 pm
I think you should check your calculation

Code: Select all

36288000 / ( 60 ^ 3 ) = 216000

But, this equation is fine.
mmmPI wrote: Sun Apr 24, 2022 9:17 am (36288000/60)/3600=168
Use a calculator and you will see who is right, after all it is mathematics.
Image

Re: Equation to convert value

Posted: Sun Apr 24, 2022 6:03 pm
by SoShootMe
yaim904 wrote: Sun Apr 24, 2022 5:36 pm I think you should check your calculation

Code: Select all

36288000 / ( 60 ^ 3 ) = 216000
You are seeing the result of the intermediate calculation (60^3 is 216000). Pressing "=" will show 168, or you need a better calculator.

Re: Equation to convert value

Posted: Sun Apr 24, 2022 6:40 pm
by pleegwat
yaim904 wrote: Sun Apr 24, 2022 8:57 am
coderpatsy wrote: Sun Apr 24, 2022 3:16 am
your calculations are wrong

Code: Select all

36288000 / ( 60 ^ 3 ) = 216000
The meaning of the ^ operator varies from platform to platform. Yours applies xor; you just calculated 36288000/63.

Re: Equation to convert value

Posted: Sun Apr 24, 2022 8:12 pm
by yaim904
SoShootMe wrote: Sun Apr 24, 2022 6:03 pm You are seeing the result of the intermediate calculation
you're right
I was seeing an intermediate value.

Re: Equation to convert value

Posted: Sun Apr 24, 2022 10:39 pm
by FuryoftheStars
yaim904 wrote: Sun Apr 24, 2022 5:36 pm
FuryoftheStars wrote: Sun Apr 24, 2022 1:12 pm
I think you should check your calculation

Code: Select all

36288000 / ( 60 ^ 3 ) = 216000

But, this equation is fine.
mmmPI wrote: Sun Apr 24, 2022 9:17 am (36288000/60)/3600=168
Use a calculator and you will see who is right, after all it is mathematics.
Image
????
Calculator.png
Calculator.png (84.63 KiB) Viewed 3061 times

Edit: Ah, someone else pointed it out to you. K.