• Welcome to Valhalla Legends Archive.
 

Idleing, [vb]

Started by FiReGoD, April 12, 2003, 02:55 PM

Previous topic - Next topic

FiReGoD

i know it was posted on here before, but the search did not come up with anything, anyone got an easy way to idle past 60 seconds because vb's timers are gay!

ILurker

Make two integer,
integer1 = ammount of seconds you want the idle to be

make the timer interval 1000
1000 = 1 second

make the timer add 1 number to the 2nd integer
then if 2nd integer = 1st integer then
send message
and set the 2nd integer to 0

drivehappy

Quote from: ™ILurker™ on April 12, 2003, 03:00 PM
Make two integer,
integer1 = ammount of seconds you want the idle to be

make the timer interval 1000
1000 = 1 second

make the timer add 1 number to the 2nd integer
then if 2nd integer = 1st integer then
send message
and set the 2nd integer to 0

If 1st Integer >= 2nd Integer Then
   2nd Integer=0
   Timer1.Enabled = False
Else
   1st Integer = 1st Integer + 1
End If

'VB sometimes will go above the 2nd Int if you don't have > in there.

ILurker

#3
Quote from: drivehappy on April 12, 2003, 07:01 PM
Quote from: ™ILurker™ on April 12, 2003, 03:00 PM
Make two integer,
integer1 = ammount of seconds you want the idle to be

make the timer interval 1000
1000 = 1 second

make the timer add 1 number to the 2nd integer
then if 2nd integer = 1st integer then
send message
and set the 2nd integer to 0

If 1st Integer >= 2nd Integer Then
   2nd Integer=0
   Timer1.Enabled = False
Else
   1st Integer = 1st Integer + 1
End If

'VB sometimes will go above the 2nd Int if you don't have > in there.


If 1st Integer >= 2nd Integer Then
-->  2nd Integer = 0
-->  Timer1.Enabled = False
Else
   1st Integer = 1st Integer + 1
End If
The way you had it, you put the wrong one to set to zero...
<That's if the 2nd integer is the idle amount the user set>

And, if it's an idle, you don't disable to timer doing it ;\

drivehappy

Quote from: ™ILurker™ on April 12, 2003, 08:50 PM
The way you had it, you put the wrong one to set to zero...
<That's if the 2nd integer is the idle amount the user set>

And, if it's an idle, you don't disable to timer doing it ;\
Ya, sorry I did put the wrong one.

I usually disable it, because I will usually have it call a function instead of doing it inside the timer. Yes, I know I forgot to put that in too, but it's just an example.

Camel

#5
http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=653;start=0

Quote from: Noodlez on January 26, 2003, 08:22 PM
Er, I meant SetTimer. Not Create.

SetTimer is a function in user32.dll

Public Declare Function SetTimer Lib "user32" Alias "SetTimer" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long


That's how you declare it.

An example call would be:
SetTimer(Me.Hwnd,&H0,delay, AddressOf SendQueue)

Skywing

Quote from: Camel on April 13, 2003, 12:41 PM
http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=653;start=0

Quote from: Noodlez on January 26, 2003, 08:22 PM
Er, I meant SetTimer. Not Create.

SetTimer is a function in user32.dll

Public Declare Function SetTimer Lib "user32" Alias "SetTimer" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long


That's how you declare it.

An example call would be:
SetTimer(Me.Hwnd,&H0,delay, AddressOf SendQueue)
Don't forget USER32's KillTimer.

FiReGoD

i did it a differant way,

i put a non-visible text box on my form and set that to the time the user wants
i set the timer to a 1000 interval
then i put another one on the form and did
txt2.text = txt2.text + 1000

and in the timer i did
if txt1.text = txt2.text then
access.send readini(a, "Idle", b) & "- [BriskBot]"
txt2.text = "0"
end if


Camel

just use settimer and killtimer. it's a little bit of work to set up, but it's hella worth it. just look at the number of people using bnu`bot before and after using settimer and killtimer. it makes the bot much more clean...and stuff...

FiReGoD

the users dont even notice a differance