Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: PsYcHiC on July 08, 2003, 08:23 PM

Title: Idles...
Post by: PsYcHiC on July 08, 2003, 08:23 PM
This is in Visual Basic 6, How would I make Idles so people can choose what idle they want? EX. Connected Uptime, System Uptime, Quotes. I'm using CSB.  And if this was posted anywhere else, direct me to it please.
Title: Re:Idles...
Post by: Tuberload on July 08, 2003, 08:32 PM
I think you should learn how to program first... Either way all you have to do is create a group of radio buttons, each represent a different idle, then have it send the idle based on the selected button.
Title: Re:Idles...
Post by: PsYcHiC on July 08, 2003, 08:59 PM
Quote from: PsYcHiC on July 08, 2003, 08:23 PM
This is in Visual Basic 6, How would I make Idles so people can choose what idle they want? EX. Connected Uptime, System Uptime, Quotes. I'm using CSB.  And if this was posted anywhere else, direct me to it please.
I know this post sounded newb, but I already have a bot made... I just need alittle help.
Title: Re:Idles...
Post by: Eternal on July 09, 2003, 04:34 AM
Look up GetTickCount...
Title: Re:Idles...
Post by: Stealth on July 09, 2003, 01:15 PM
or... because you should learn Visual Basic before attempting to write a bot in it?
Title: Re:Idles...
Post by: Camel on July 09, 2003, 02:06 PM
I didn't really read if the question was answered, but the uptime question has already been addressed here: http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=1298;start=msg10502#msg10502

Quote from: Camel on May 23, 2003, 02:49 PM
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


?UpTime
Computer on for 1w 2d 23h 03m 30s, running for 22h 04m 08s, logged on for 22h 04m 07s

Title: Re:Idles...
Post by: Skywing on July 09, 2003, 04:38 PM
Remember that GetTickCount will reset every 49.7 days; I'd recommend against using it for uptime.  That is, unless you're expecting to crash every few days :-)
Title: Re:Idles...
Post by: Camel on July 09, 2003, 04:42 PM
Very few windows users leave their computers on for longer than 20 or so. Besides, if you're not going to provide a better solution, what's the point of posting?
Title: Re:Idles...
Post by: Kp on July 09, 2003, 04:55 PM
Quote from: Camel on July 09, 2003, 04:42 PM
Very few windows users leave their computers on for longer than 20 or so. Besides, if you're not going to provide a better solution, what's the point of posting?
I stay up until the system forces me to go down, usually either due to hardware change or installing anything from Microsoft.  Skywing tends to maintain uptimes even longer than mine.
Title: Re:Idles...
Post by: Skywing on July 09, 2003, 05:42 PM
Quote from: Camel on July 09, 2003, 04:42 PM
Very few windows users leave their computers on for longer than 20 or so. Besides, if you're not going to provide a better solution, what's the point of posting?
This has been covered before.

Query the performance counter "System\System Up Time" or use QueryPerformanceCounter/QueryPerformanceFrequency (the former is slower, the latter isn't guaranteed to work right under all processors).
Title: Re:Idles...
Post by: Thing on July 09, 2003, 05:56 PM
Current longest uptime:
(http://www.vpnsys.com/uptime.gif)
Title: Re:Idles...
Post by: Camel on July 09, 2003, 06:48 PM
I said "most users" intentionally.
I'll look into that, Skywing.

Thing, how does that have anything at all to do with windows uptime? I've had 230+ days on a linux box before; 104 is nothing to brag about. Besides, is this forum named "post your best uptime?" I think not.
Title: Re:Idles...
Post by: Skywing on July 09, 2003, 06:54 PM
Quote from: Thing on July 09, 2003, 05:56 PM
Current longest uptime:
(http://www.vpnsys.com/uptime.gif)
I had about 170 on Win2K before a power outage zapped it..
Title: Re:Idles...
Post by: Camel on July 09, 2003, 07:00 PM
Well that was easy:
Public Function GetSecondCount() As Currency
   Dim qpCounter As Currency, qpFrequency As Currency
   QueryPerformanceCounter qpCounter
   QueryPerformanceFrequency qpFrequency
   GetSecondCount = qpCounter / qpFrequency
End Function
Title: Re:Idles...
Post by: Thing on July 09, 2003, 07:10 PM
QuoteThing, how does that have anything at all to do with windows uptime?
It doesn't.

Quote104 is nothing to brag about.
I know.  That is just my current longest uptime.

QuoteBesides, is this forum named "post your best uptime?" I think not.
I think you need a nap.
Title: Re:Idles...
Post by: Camel on July 09, 2003, 08:30 PM
Yeah, sorry; I was feeling a little...eh...when I posted that.
Title: Re:Idles...
Post by: JoeCool on July 10, 2003, 01:42 AM
nice big ass code
Quote
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
by any change, what name would i name the "timer" :/ and is it for cbs and what would i put under UserTalk

Access=RetrieveAccess(Access,Username)
If Access= "M" Then
??????