Jump to content

Using a timer with bot script


Recommended Posts

Hey guys. Im ganna show you my problemo

Func _Main()
    HotKeySet("{ESC}", "_Quit")

    Local $starttime = _Timer_Init()
    While 1
        ToolTip(_Timer_Diff($starttime))
    WEnd
EndFunc;==>_Main

Is autoitscript's example of timer_init.

Heres what i need to incorporate it into

* not a real source *

Func CreateGame()
Start $timer
IF $TIMER = 60 then   ---------------------------------------------------------Here
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
WalkToPortal()
End Func

Func Walktoportal()
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
EndFunc

Func Kill()
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
EndFunc

Func ExitGame()
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
creategame()
End Func

O.o

would it be like

FUnc Creategame
Local $starttime = _Timer_Init()
If $StartTime = Sleep(60000) Then
Mouseclick("Left", 393,239)
Else
Sleep(50)
EndIf
Mouseclick("Left", 393,239)
Mouseclick("Left", 393,239)
Mouseclick("Left", 393,239)
WalkToPortal()
Endfunc
Edited by ecstatic
Link to comment
Share on other sites

u mean this?

Func CreateGame()
Local $starttime = _Timer_Init()
do
Sleep(10)
until _Timer_Diff($starttime) >= 60000; 60 seconds
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
WalkToPortal()
End Func
Link to comment
Share on other sites

Well its like this

I play a game called diablo II

if ur not in a game for atleast 3 minutes, and you constantly remake games, you get a IP Restriction.

So my purpose of a timer is that when my bot is completed doing the run, and the game WAS 3 minutes, hence the If sleep then it will mak a new game

Link to comment
Share on other sites

u mean this?

Func CreateGame()
Local $starttime = _Timer_Init()
do
Sleep(10)
until _Timer_Diff($starttime) >= 60000; 60 seconds
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
Mouseclick("Left", 932,483)
WalkToPortal()
End Func
The problem with that is.

It has to go threw 4 different functions, then loop back to creategame to see if the timer is up.

WOuld this work?

Link to comment
Share on other sites

the create game function waits 60 seconds then goes ahead with the rest of the function

well thats the problem.

Its like this.

1) Bot creates game, timer starts

2) It walks to a portal.

3) Kills monster

4) Loots

5) Leaves

6) Loops back to creates game

I want it to sleep @ step 6 unless it was in game for 60 seconds.

Do you catch my drift

Link to comment
Share on other sites

#include <Timers.au3>

$timer = _Timer_Init()
CreateGame()
Func CreateGame()

    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    Walktoportal()
EndFunc  ;==>CreateGame

Func Walktoportal()
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    Kill()
EndFunc  ;==>Walktoportal

Func Kill()
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    ExitGame()
EndFunc  ;==>Kill

Func ExitGame()
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    Do
        Sleep(10)
    Until _Timer_Diff($timer) >= 60000; 60 seconds
    Global $timer = _Timer_Init()
    CreateGame()
EndFunc  ;==>ExitGame

Link to comment
Share on other sites

#include <Timers.au3>

$timer = _Timer_Init()
CreateGame()
Func CreateGame()

    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    Walktoportal()
EndFunc ;==>CreateGame

Func Walktoportal()
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    Kill()
EndFunc ;==>Walktoportal
Yes this will work thank you!

But one more question, how would i incorporate a tooltip timer

like so?
[code]
If Not IsDeclared("sToolTipAnswer") Then Local $sToolTipAnswer
$sToolTipAnswer = ToolTip("Were sleeping for seconds" $Timer  "so we can avoid a realm down",Default,Default,"D2Ai",1,0)
Link to comment
Share on other sites

Func ExitGame()
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    Do
        ToolTip('We''re sleeping for 60 Seconds so we can avoid a realm down',Default,Default,"D2Ai",1,0)
        Sleep(10)
    Until _Timer_Diff($timer) >= 60000; 60 seconds
    Global $timer = _Timer_Init()
    CreateGame()
EndFunc ;==>ExitGame

Link to comment
Share on other sites

Func ExitGame()
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    MouseClick("Left", 932, 483)
    Do
        ToolTip('We''re sleeping for 60 Seconds so we can avoid a realm down',Default,Default,"D2Ai",1,0)
        Sleep(10)
    Until _Timer_Diff($timer) >= 60000; 60 seconds
    Global $timer = _Timer_Init()
    CreateGame()
EndFunc;==>ExitGame
That will update the tooltip every second?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...