Sign in to follow this  
Followers 0
salter

Need some help with script

5 posts in this topic

#1 ·  Posted (edited)

Hi i need some help with this script im working on.

What im having troubles figuring out is how to make it so the AFK function goes of every 15 minutes

and also in the Fight function how would i make it just stop if it takes longer then 15 seconds.

If you could help me out with these two problems that would be great. thx

Script:

; Script Start

Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Hotkeyset("{HOME}","start")
Hotkeyset("{END}","stop")

$stop = 1

Func start()
If Not WinExists("AlefClient") Then
         MsgBox(0, Random(0, 100), "Archlord must be opened.")
         Exit
      EndIf
WinActivate ( 'AlefClient' )
Sleep ( 300 )
$stop = 0
If $stop = 0 Then
While 1
Search()
Fight()                   
getitems()
WEnd

Else

Sleep(1000)

EndIf
EndFunc




Func Search()                               
While 1
send("{LSHIFT down}")         
Sleep(Random(40, 55))               
send("{Tab}")                         
Sleep(Random(900, 1070))           
send("{LSHIFT up}")                   
Sleep(Random(450, 520))               
$var = PixelGetColor(424, 25)       
If $var = 0xD63839 then             
Send("3")
ExitLoop                           
Else
Sleep(Random(70, 120))
Send("{LEFT}")
Sleep(Random(70, 120))
Send("{LEFT}")
EndIf
WEnd
EndFunc                                    




Func Fight()                                 
    Sleep(Random(450, 600))
    While PixelGetColor(424, 25) = 0xD63839
        Sleep(Random(900, 1200))
    WEnd
    Sleep(Random(95, 135))
EndFunc                                      



Func Getitems()                             
Sleep(Random(800, 1500))
Send("{SPACE}")
Sleep(Random(250, 380))
MouseMove (456,776)          
Sleep(Random(100, 180))
MouseMove (234,897)
Sleep(Random(100, 180))
Send("{SPACE}")
Sleep(Random(250, 380))
Send("{SPACE}")
Sleep(Random(250, 380))
Send("{SPACE}")
Sleep(Random(250, 380))
EndFunc                                      



Func AFK()                                       
MouseMove (456,776)          
Sleep(Random(100, 180))
MouseMove (234,897)
Sleep(Random(100, 180))
Send("m")
Sleep(Random(400, 600))
Send("m")
Sleep(Random(100, 180))
EndFunc                                     




Func stop()
Exit
EndFunc

While 1
Sleep(50)
WEnd
Edited by salter

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

; Script Start

Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Hotkeyset("{HOME}","start")
Hotkeyset("{END}","stop")

$stop = 1

Func start()
If Not WinExists("AlefClient") Then
         MsgBox(0, Random(0, 100), "Archlord must be opened.")
         Exit
      EndIf
WinActivate ( 'AlefClient' )
Sleep ( 300 )
$stop = 0
If $stop = 0 Then
While 1
Search()
Fight()                   
getitems()
WEnd

Else

Sleep(1000)

EndIf
EndFunc




Func Search()                               
While 1
send("{LSHIFT down}")         
Sleep(Random(40, 55))               
send("{Tab}")                         
Sleep(Random(900, 1070))           
send("{LSHIFT up}")                   
Sleep(Random(450, 520))               
$var = PixelGetColor(424, 25)       
If $var = 0xD63839 then             
Send("3")
ExitLoop                           
Else
Sleep(Random(70, 120))
Send("{LEFT}")
Sleep(Random(70, 120))
Send("{LEFT}")
EndIf
WEnd
EndFunc                                   




Func Fight()                              
$timer2 = timerinit()   
    Sleep(Random(450, 600))
    While PixelGetColor(424, 25) = 0xD63839
if timerdiff($timer2) > 15 * 1000 then return
        Sleep(Random(900, 1200))
    WEnd
    Sleep(Random(95, 135))
EndFunc                                     



Func Getitems()                             
Sleep(Random(800, 1500))
Send("{SPACE}")
Sleep(Random(250, 380))
MouseMove (456,776)         
Sleep(Random(100, 180))
MouseMove (234,897)
Sleep(Random(100, 180))
Send("{SPACE}")
Sleep(Random(250, 380))
Send("{SPACE}")
Sleep(Random(250, 380))
Send("{SPACE}")
Sleep(Random(250, 380))
EndFunc                                     



Func AFK()                                       
MouseMove (456,776)         
Sleep(Random(100, 180))
MouseMove (234,897)
Sleep(Random(100, 180))
Send("m")
Sleep(Random(400, 600))
Send("m")
Sleep(Random(100, 180))
EndFunc                                     




Func stop()
Exit
EndFunc

$timer1 = timerinit()

While 1
if timerdiff($timer1) > 15 * 1000 then
AFK()
$timer1 = timerinit()
endif
WEnd

is that what you want?

edit: formatting

Edited by spyrorocks

Share this post


Link to post
Share on other sites

Cool thx for that.

how could i add a function that hits 7 every 650 seconds?

Share this post


Link to post
Share on other sites

HI,

have a look at TimerDIff or do it with sleep.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

HI,

or use this. Something I wrote long time ago. :)

HotKeySet("{ESC}", "_end")

_sendLoop("{Enter}", 2000, 100, 5)

Func _sendLoop($sKey = "1", $iTime = 500, $iSleep = 100, $iCount = -1, $tooltip = 1)
    Local $t = TimerInit()
    Local $i = 0
    While 1
        If TimerDiff($t) >= $iTime Then
            Send($sKey) ; do what you want
            $t = TimerInit()
            $i += 1
        Else
            Sleep($iSleep)
        EndIf
        If $iCount <> - 1 Then
            If $i = $iCount Then Return 1
        EndIf
        If $tooltip = 1 Then ToolTip("Difference: " & StringFormat("%0.6d", TimerDiff($t)) & " ms" & " | counter : " & $i)
    WEnd
EndFunc   ;==>_sendLoop

Func _end()
    Exit (0)
EndFunc   ;==>_end

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
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
Sign in to follow this  
Followers 0