Valhalla Legends Forums Archive | Battle.net Bot Development | Bot Uptime

AuthorMessageTime
OcTaViuS
can anyone teach me how to do it correctly? :-\

i know the general concept of how to do it, and tried searching the forums for the answer but all the examples confused me. (which is surprisingly ez with all the stress i been having to handle lately) i need to know stuff like how to properly declare all the neccassary functions like GetTickCount n'such.

Aswell it would be nice to get example coding on how to use the functions. I'm planning on using bot uptime for an idle, but that doesnt really matter, all im asking for is the general coding for it.

help is greatly appreciated. :-\
May 11, 2003, 4:52 AM
Yoni
And we are to understand you are coding in Ada?
May 11, 2003, 11:29 AM
iago
I assumed it was java..

use System.getTime().
May 11, 2003, 3:49 PM
OcTaViuS
VB my bad :-[
May 11, 2003, 5:00 PM
K
I'll try to help you without giving you code. This makes you "smarter (tm)" and "more independent (tm)".

You want to know how long your bot has been connected. You'll need to do three things:
1) Store at what time your bot connected.
2) Determine what time it is "now."
3) Find how much greater "now" is than the time in step 1.

Visual Basic has several helpful functions that you can use. Play around with Now() and the DateDiff() function, which returns the difference between two DateTimes.

Good luck.
May 11, 2003, 5:44 PM
Camel
[quote author=K link=board=17;threadid=1298;start=0#msg9699 date=1052675086]
Visual Basic has several helpful functions that you can use. Play around with Now() and the DateDiff() function, which returns the difference between two DateTimes.
[/quote]

i prefer gettickcount, as long as you're only trying to find the ammount of time difference,t here's no need for those. may be a good idea if you're just learning tho.
May 11, 2003, 5:53 PM
K
Except that with GetTickCount() you have milliseconds which you need to convert into a readable format; the DateTime will take care of that for you, which is why I recommended it.
May 11, 2003, 7:21 PM
OcTaViuS
[quote author=K link=board=17;threadid=1298;start=0#msg9699 date=1052675086]
I'll try to help you without giving you code. This makes you "smarter (tm)" and "more independent (tm)".

You want to know how long your bot has been connected. You'll need to do three things:
1) Store at what time your bot connected.
2) Determine what time it is "now."
3) Find how much greater "now" is than the time in step 1.
[/quote]

ya i knew that already :P i coulda sworn i said i knew the concept of how its done.

and im more of a visual learner then someone who learns by doing. in other words i learn better by visually seeing the code then spending hours trying to figure it out. and i'd have to say im pretty independant. ive only known VB since last january (started programming with QB last november). my first project using VB is a chat bot and this is only the 2nd time ive required help. (for some reason i have a harder time working with the ez stuff then the hard stuff)
May 11, 2003, 7:34 PM
tA-Kane
[quote author=OcTaViuS link=board=17;threadid=1298;start=0#msg9705 date=1052681656]for some reason i have a harder time working with the ez stuff then the hard stuff[/quote]I know that feeling ;)
All it takes to overcome that, though, is to try, try, and try harder. And if that fails, that you step back and take look at why you're trying too hard.
May 11, 2003, 10:19 PM
drivehappy
Private Sub Form_Load()
r = Now 'Set your first time to when it connects
End Sub

Private Sub Whatever()
g = Now 'Set your second time when you want to check date diff
Msgbox GetDiff(r,g)
End Sub

Private Function GetDiff(Date1 as Date, Date2 as Date)
GetDiff = DateDiff("h", Date1, Date2) ' "h" is an interval, check below for more settings
End Function



Setting Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
m Minute
s Second
May 11, 2003, 11:19 PM
St0rm.iD
[quote author=iago link=board=17;threadid=1298;start=0#msg9692 date=1052668142]
I assumed it was java..

use System.getTime().
[/quote]

no.
May 12, 2003, 9:00 PM
OcTaViuS
[quote author=drivehappy link=board=17;threadid=1298;start=0#msg9718 date=1052695185]
Setting Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
m Minute
s Second
[/quote]

umm, is "m" for Month or Minute? you listed it for both. im guessing its for month since it doesnt seem to work for me as minute. but if thats the case then wuts the one for minute?
May 23, 2003, 1:35 AM
Camel
[quote author=OcTaViuS link=board=17;threadid=1298;start=0#msg10458 date=1053653732]
[quote author=drivehappy link=board=17;threadid=1298;start=0#msg9718 date=1052695185]
Setting Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
m Minute
s Second
[/quote]

umm, is "m" for Month or Minute? you listed it for both. im guessing its for month since it doesnt seem to work for me as minute. but if thats the case then wuts the one for minute?
[/quote]

yeah, for a while my bot was displaying the month instead of the minute in the timestamp >.<
minute is n
May 23, 2003, 1:40 AM
Slugger69
Case "sysuptime"
Send "[me=Slugger69]Bot Uptime - " & vbTab & vbTab & vbTab & ConvertTime(GetTickCount - RunningTime)[/me]
Send "[me=Slugger69]System Uptime - " & ConvertTime(GetTickCount()) & " [/me]

that would work on VB for uptime on bot and cpu
May 23, 2003, 4:10 AM
Noodlez
ConvertTime is not a standard VB function; it would be nice if you provided the code to it if you're going to use it in an example.
May 23, 2003, 5:57 AM
MrRaza
im surprized that he created his own function, did he?
May 23, 2003, 11:44 AM
Camel
[code]Public Function UpTime() As String
Dim ticks As Long
ticks = GetTickCount
UpTime = "Computer on for " & GetTime(ticks) & _
", running for " & GetTime(ticks - StartTime) & _
", logged on for " & GetTime(ticks - LogTime)
End Function

Public Function Zero(str As String, Count As Long, Optional Char As Byte = "0") As String
Zero = String(Count - Len(str), CStr(Char)) & str
End Function

Public Function GetTime(ByVal ticks As Long, Optional ShowDecimals As Boolean = False) As String
Dim TS As Long, TM As Long, TH As Long, TD As Long, TW As Long

TS = ticks \ 1000: ticks = ticks - TS * 1000
TM = TS \ 60: TS = TS - TM * 60
TH = TM \ 60: TM = TM - TH * 60
TD = TH \ 24: TH = TH - TD * 24
TW = TD \ 7: TD = TD - TW * 7

GetTime = Zero(CStr(TS), 2) & IIf(ShowDecimals, "." & Zero(CStr(ticks), 3), "") & "s"
If TM + TH + TD + TW > 0 Then GetTime = Zero(CStr(TM), 2) & "m " & GetTime
If TH + TD + TW > 0 Then GetTime = Zero(CStr(TH), 2) & "h " & GetTime
If TD + TW > 0 Then GetTime = CStr(TD) & "d " & GetTime
If TW > 0 Then GetTime = CStr(TW) & "w " & GetTime
End Function[/code]

[code]?UpTime
Computer on for 1w 2d 23h 03m 30s, running for 22h 04m 08s, logged on for 22h 04m 07s[/code]
May 23, 2003, 7:49 PM
OcTaViuS
camel u r god :o. not only did u successfully answer my bot uptime question without making me guess on how to fix the code, but u also gave me the code for cpu uptime and connection uptime, the two uptimes i was about to try and figure out during the weekend.

gj & ty 8)
May 24, 2003, 12:42 AM
Kp
[quote author=OcTaViuS link=board=17;threadid=1298;start=15#msg10517 date=1053736946]
camel u r god :o. not only did u successfully answer my bot uptime question without making me guess on how to fix the code, but u also gave me the code for cpu uptime and connection uptime, the two uptimes i was about to try and figure out during the weekend.
gj & ty 8)
[/quote]However, the code as provided won't properly render typical service uptimes. You need a higher resolution solution.
May 24, 2003, 4:44 AM
OcTaViuS
[quote author=Kp link=board=17;threadid=1298;start=15#msg10532 date=1053751457]
However, the code as provided won't properly render typical service uptimes. You need a higher resolution solution.
[/quote]

way to spoil the mood.
May 24, 2003, 4:51 AM
MrRaza
It's really not that hard. I'm sure that there is an example on pscode.com
May 25, 2003, 8:59 PM
OcTaViuS
mr. raza, camels method works perfectly...
May 25, 2003, 9:05 PM
MrRaza
I was regarding to the High Resolution solution kp was talking about.
May 25, 2003, 9:25 PM
Camel
[quote author=MrRaza link=board=17;threadid=1298;start=15#msg10649 date=1053897948]
I was regarding to the High Resolution solution kp was talking about.
[/quote]

use quotes, fooligan
May 26, 2003, 4:51 PM
OcTaViuS
betcha cant say "Resolution Solution" 10x fast :o good one KP ::)
May 26, 2003, 7:35 PM

Search