Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: FiReGoD on February 27, 2003, 04:48 PM

Title: [VB] Idle Question
Post by: FiReGoD on February 27, 2003, 04:48 PM
i cant get my idle to go past 60 seconds i am just using

idle.interval = txtidle
Title: Re: [VB] Idle Question
Post by: Banana fanna fo fanna on February 27, 2003, 05:31 PM
That is gross.

Use idle.interval = val(txtidle.text)

That should make your code more readable, and could make it work, too!
Title: Re: [VB] Idle Question
Post by: FiReGoD on February 27, 2003, 05:56 PM
yea, but isnt there a cap on how many seconds you can use?
Title: Re: [VB] Idle Question
Post by: Skywing on February 27, 2003, 06:02 PM
Quoteyea, but isnt there a cap on how many seconds you can use?
That depends on how you're doing your timers.  It's not difficult to devise a system which permits quite long wait intervals.  Perhaps you should elaborate on just what exactly you're doing now?
Title: Re: [VB] Idle Question
Post by: Crypticflare on February 28, 2003, 02:25 AM
Well for my idles, I set the timer  for 30 Second Intervals that way you won't flood yourself off. All I did was if your idle was 20, it would idle for 10 minutes, since there are two sets of 30's in a minute.. not the greatest thing ever, but it works for me.
Title: Re: [VB] Idle Question
Post by: Camel on February 28, 2003, 07:14 AM
Quoteidle.interval = txtidle

interval is an integer, so it is capped at 65535 ms, or "65ish" seconds (they're not very accurate). you cannot push it past that afaik; but you can have it not execute whatever idle code you have every time it calls idle_Timer()

If (GetTickCount - LastChat) > IdleTime Then
Title: Re: [VB] Idle Question
Post by: warz on February 28, 2003, 08:47 AM
Just set timer interval to one second, and have it increment a variable by one each second. when that variable is equal to your idle time, have it send the idle message and reset the variable to zero.
Title: Re: [VB] Idle Question
Post by: FyRe on February 28, 2003, 11:10 AM
Private Sub TimerAway_Timer()
    Dim Timer As Integer
    If Not frmMain.wsBnet.State = sckConnected Then: Exit Sub
    If BNET.varAwayIdle = "1" Then
        If GetTickCount - LastTalk >= 60000 Then
            If awayFlag = False Then
            End If
            awayFlag = True
            idleFlag = True
            Send "/away Bot has been idle for " & FormatCount(GetTickCount - LastTalk, 3) & ".", frmMain.wsBnet
        End If
        Else
            If GetTickCount - LastTalk >= 90000 Then
                SendBanner
            End If
    End If
End Sub

That's how I do it.
Title: Re: [VB] Idle Question
Post by: Yoni on February 28, 2003, 11:19 AM
Should do something like
Private Sub OneSecondTimer_Timer()
  Static SecondsPassed As Long
  SecondsPassed = (SecondsPassed + 1) Mod HoweverManySecondsYouWantToCount
  If SecondsPassed = 0 Then
    ' Do whatever
  End If
End Sub
Exact same code if you want to count minutes instead of seconds, but use an Interval of 60000 instead of 1000.
Title: Re: [VB] Idle Question
Post by: haZe on February 28, 2003, 12:06 PM
if txtidle.text > 999 then txtidle.text = "" msgbox "idle too long :/"
Title: Re: [VB] Idle Question
Post by: FiReGoD on February 28, 2003, 12:27 PM
haze, i know that and i already have that, but i want it to go past 60000
Title: Re: [VB] Idle Question
Post by: warz on February 28, 2003, 01:41 PM
Read what I posted.

"Just set timer interval to one second, and have it increment a variable by one each second. when that variable is equal to your idle time, have it send the idle message and reset the variable to zero. "
Title: Re: [VB] Idle Question
Post by: FiReGoD on February 28, 2003, 02:39 PM
there isnt an easier way, that seems buggy dont you think?
Title: Re: [VB] Idle Question
Post by: Banana fanna fo fanna on February 28, 2003, 02:54 PM
wtf? Of course not.
Title: Re: [VB] Idle Question
Post by: Camel on February 28, 2003, 04:35 PM
inaccurate? yes. buggy? no.
Title: Re: [VB] Idle Question
Post by: FiReGoD on February 28, 2003, 05:54 PM
inaccurate?
Title: Re: [VB] Idle Question
Post by: Camel on February 28, 2003, 06:21 PM
it'll work fine, but vb timers aren't known for triggering on time
Title: Re: [VB] Idle Question
Post by: Yoni on March 01, 2003, 03:14 PM
It should be accurate.

The VB Timer control is a wrapper around the Win32 SetTimer function and WM_TIMER message (aka the "User32 timer").
Although the User32 timer is a low-resolution timer, for such high intervals (an entire second) it will be accurate. (You may still lose a millisecond or three because of the VB VM's overhead.)

It will only be inaccurate if you specify a low interval that requires a high-resolution timer. I wouldn't trust it to be accurate with an interval lower than about 50.