Kindly explain this i.e tickcount

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Johana
Posts: 189
Joined: 02 May 2017, 02:34

Kindly explain this i.e tickcount

21 Oct 2017, 17:07

Code: Select all

settimer, time_routine, % 1000 * 100 			; check status of ahk-script-file evey 100 seconds and reload if necessary
Here it's 1000 * 100.. Why not just write 100000?

Here's a different place i saw a simliar code being used:

Code: Select all

e:: t := A_TickCount + ((1000 * 60) * 60) 
Why not just sum it up to 3600000 and write

Code: Select all

e:: t := A_TickCount + 3600000 
?
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Kindly explain this i.e tickcount

21 Oct 2017, 17:13

Readbility and maintainability. Also you will miss eventually miss a zero if you are typing 360000 instead of 60 * 60 * 1000.
Cheers.
Johana
Posts: 189
Joined: 02 May 2017, 02:34

Re: Kindly explain this i.e tickcount

21 Oct 2017, 17:22

Helgef wrote:Readbility and maintainability. Also you will miss eventually miss a zero if you are typing 360000 instead of 60 * 60 * 1000.
Cheers.

Really? That's all? Just readability? Are there any set of rules? In my first code with that settimer, there is a percentage sign. What does it do?
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Kindly explain this i.e tickcount

21 Oct 2017, 17:38

Johana wrote:Just readability?
No, also maintainability, eg, you if have 60 * 60 * 1000 and want to change to 57.15 * 60 * 1000, that is very easy and quick. Compare with changing from 3600000 to 3429000 :roll:
Johana wrote:Are there any set of rules?

No, you are free to do it in whichever way you prefer!
In my first code with that settimer, there is a percentage sign. What does it do?
A single % is to Force an expression.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Kindly explain this i.e tickcount

22 Oct 2017, 01:00

IMHO it's so much simpler to see that % 1000 * 60 * 5 are five minutes, or % 1000 * 1.5 are one and a half second ... :)
Johana
Posts: 189
Joined: 02 May 2017, 02:34

Re: Kindly explain this i.e tickcount

22 Oct 2017, 01:31

Thank you Helgef and Bobo, I actually understand now (thank God) :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Spawnova and 266 guests