Valhalla Legends Forums Archive | Battle.net Bot Development | Help Me With GetTickCount

AuthorMessageTime
ChR0NiC
Ok I want to use GetTickCount to calculate how long someone has been in the channel for unless they were already there when I was joined. But I can't seem to get it to work for each individual user. Only join/leave to do with everyone.

I am using VB.

[code]
Private Sub Event_Join
JoinTime = GetTickCount
End If

Private Sub Event_Leave
addC vbGreen, strUser has left the channel after " & FormatCount(GetTickCount - JoinTime)
End Sub
[/code]

That is basically what I am trying to do. If anyone can help me out...please do. Thanks alot guys ^^
December 13, 2003, 6:07 AM
Soul Taker
That will only work if no one joins between each user joining and leaving.
December 13, 2003, 6:34 AM
Adron
Unless JoinTime is a member variable of a class?
December 13, 2003, 12:14 PM
iago
You should also note that GetTickCount isn't completely reliable for a couple reasons. The only one I know is overflow problems if your computer is on for a very long time.

Also note that GetTickCount is milliseconds, not seconds.
December 13, 2003, 1:47 PM
Spht
[quote author=iago link=board=17;threadid=4206;start=0#msg35097 date=1071323236]
You should also note that GetTickCount isn't completely reliable for a couple reasons. The only one I know is overflow problems if your computer is on for a very long time.
[/quote]

That can easily be worked around with something like a GetDifference function which can safely calculate GetTickCount differences from positive to positive, negative to positive, negative to negative, and positive to negative.
December 13, 2003, 3:09 PM
iago
What if it resets? Like, they join at 0xFFFFFFF8, and they leave at 15? Or what if they stay in the channel more than 28 days?
December 13, 2003, 3:14 PM
Spht
[quote author=iago link=board=17;threadid=4206;start=0#msg35110 date=1071328460]
What if it resets? Like, they join at 0xFFFFFFF8, and they leave at 15?
[/quote]

Would return 0x0100000007 (Double).

[quote author=iago link=board=17;threadid=4206;start=0#msg35110 date=1071328460]
Or what if they stay in the channel more than 28 days?
[/quote]

What if? Then I'd be checking a negative with a positive (which is what the function is prepared to handle).
December 13, 2003, 3:26 PM
Adron
All of this works much better in C/C++, where you just do the subtraction, get the overflow (which is ignored), and get the correct value. It will work fine as long as the user hasn't been there more than 2**32-1 milliseconds.


edit: -1 milliseconds
December 13, 2003, 3:31 PM
iago
[quote author=Spht link=board=17;threadid=4206;start=0#msg35114 date=1071329199]
Would return 0x0100000007 (Double).
[/quote]

GetTickCount returns a DWORD, which will never pass 0xFFFFFFFF.

How do you get 0x100000007?
December 13, 2003, 3:37 PM
Spht
[quote author=iago link=board=17;threadid=4206;start=0#msg35119 date=1071329836]
[quote author=Spht link=board=17;threadid=4206;start=0#msg35114 date=1071329199]
Would return 0x0100000007 (Double).
[/quote]

GetTickCount returns a DWORD, which will never pass 0xFFFFFFFF.

How do you get 0x100000007?
[/quote]

You gave me two numbers to find difference of, so can go over 0xFFFFFFFF... 0xFFFFFFFF*2 == 0x1FFFFFFFE for example.
December 13, 2003, 4:12 PM
Adron
[quote author=Spht link=board=17;threadid=4206;start=0#msg35124 date=1071331936]
[quote author=iago link=board=17;threadid=4206;start=0#msg35119 date=1071329836]
[quote author=Spht link=board=17;threadid=4206;start=0#msg35114 date=1071329199]
Would return 0x0100000007 (Double).
[/quote]

GetTickCount returns a DWORD, which will never pass 0xFFFFFFFF.

How do you get 0x100000007?
[/quote]

You gave me two numbers to find difference of, so can go over 0xFFFFFFFF... 0xFFFFFFFF*2 == 0x1FFFFFFFE for example.
[/quote]

What you did was find the sum though...
December 13, 2003, 5:58 PM

Search