Jump to content

plz help compile script


Recommended Posts

i have 2 scripts

1. find monster for games - SRO (need find monster and after find mouseclick left )

; --------------------------------------------------
;  Function:        _FindMonster()
;  Arguments:       None
;  Returns:         Array with click coordinates to select a monster
;                        $array[0] - Xcoord $array[1] - Ycoord
;  Author:          djingis1
;  Description:    Finds a monster and returns coords to click
;                        Note: SRO RESOLUTION 800*600 REQUIRED
; --------------------------------------------------
Func _FindMonster()
    Dim $iCoord
    While (1)
        
        $iCoord = PixelSearch(250,225,374,274,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
        
        $iCoord = PixelSearch(375,225,474,274,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
        
        $iCoord = PixelSearch(415,275,474,359,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
        
        $iCoord = PixelSearch(375,360,474,399,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
        
        $iCoord = PixelSearch(250,225,374,399,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
        
        $iCoord = PixelSearch(250,175,474,224,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
            
        $iCoord = PixelSearch(475,175,574,399,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
        
        $iCoord = PixelSearch(0,400,424,474,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
        
        $iCoord = PixelSearch(0,175,259,399,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
        
        $iCoord = PixelSearch(0,100,664,174,0xFF00FF,25,1)
        if @error <> 1 then ExitLoop
            
      ; The sleep is there to prevent the PixelSearches
      ; from lagging the script a lot if a monster is not found
      ; in the first loop
        Sleep(250)

$click = _FindMonster()
MouseClick('left',$click[0],$click[1],1,0)
attack()

    WEnd
  
  $iCoord[0] = $iCoord[0] + 4
  $iCoord[1] = $iCoord[1] + 4
  Return $iCoord
EndFunc

2- after find and click monster need attack him

HotKeySet("{PAUSE}", "Pause") 
Global $Paused 
while 1 
If WinActive("SRO_Client") and PixelGetColor(77,47) = 3947324  then;IF ACTIVE AND INGAME 
  
; USE SKILL 1 (mine is sword attack, strike and smash) UNLESS MONSTER IS CLOSE TO DYING 
        if (PixelGetColor(605,23) = 14077580 and PixelGetColor(442,45) = 16762566) then 
   Send("2") 
   Sleep(1000) 
 EndIf 
; USE SKILL 7 (mine is combo sword attack (5hits)) UNLESS MONSTER IS ALMOST DOWN 
 if (PixelGetColor(605,23) = 14077580 and PixelGetColor(475,45) = 16743291) then 
   Send("1") 
   Sleep(1000) 
 EndIf 
      ; USE IMBUE SKILL (mine is skill 2) UNLESS MONSTER IS ALMOST DOWN 
 if (PixelGetColor(605,23) = 14077580 and PixelGetColor(475,45) = 16743291) then 
   Send("3") 
   Sleep(1000) 
 EndIf 
; USE SKILL 5 (mine is sword attack, stab and smash)UNLESS MONSTER IS CLOSE TO DYING 
 if (PixelGetColor(605,23) = 14077580 and PixelGetColor(442,45) = 16762566) then 
   Send("4") 
   Sleep(1000) 
 EndIf 
  
;THIS WILL TRY AND PICK UP ANYTHING EVEN IF YOU WALK PASSED SOME GOLD 
  
  Send("g"); CHECK WICH KEY TO USE IN SILKROAD OPTIONS !! 
  Sleep(1000); DEFAULT GRABKEY IN SILKROAD IS "G" 
endif 
wend 
Func Pause() 
    $Paused = NOT $Paused 
While  $Paused 
        Sleep (100) 
WEnd 
EndFunc; => Pause()

plz fix and compile scripts in one, need result - in aktive window SROgames find monster => click monster => attack monster and loop this operation

помогите собрать скрипт из 2-х, нужно в скрипте чтобы нашло монстра, нажало на нем, атаковало его, и так повторять эту операцию

THS (спасибо) !!

Edited by AdreNalinE
Link to comment
Share on other sites

Hi,

does this help?

HotKeySet("{PAUSE}", "Pause")
HotKeySet("1", "_FindMonster")
HotKeySet("2", "attack")
Global $Paused

; --------------------------------------------------
;  Function:        _FindMonster()
;  Arguments:        None
;  Returns:            Array with click coordinates to select a monster
;                         $array[0] - Xcoord    $array[1] - Ycoord
;  Author:            djingis1
;  Description:       Finds a monster and returns coords to click
;                         Note: SRO RESOLUTION 800*600 REQUIRED
; --------------------------------------------------

Func _FindMonster()
    Dim $iCoord
    While 1
        $iCoord = PixelSearch(250, 225, 374, 274, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(375, 225, 474, 274, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(415, 275, 474, 359, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(375, 360, 474, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(250, 225, 374, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(250, 175, 474, 224, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(475, 175, 574, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 400, 424, 474, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 175, 259, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 100, 664, 174, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        ; The sleep is there to prevent the PixelSearches
        ; from lagging the script a lot if a monster is not found
        ; in the first loop
        Sleep(250)
        $click = _FindMonster()
        MouseClick('left', $click[0], $click[1], 1, 0)
        attack()
    WEnd
    $iCoord[0] = $iCoord[0] + 4
    $iCoord[1] = $iCoord[1] + 4
    Return $iCoord
EndFunc   ;==>_FindMonster


Func attack()
    While 1
        If WinActive("SRO_Client") And PixelGetColor(77, 47) = 3947324 Then;IF ACTIVE AND INGAME
            ; USE SKILL 1 (mine is sword attack, strike and smash) UNLESS MONSTER IS CLOSE TO DYING
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(442, 45) = 16762566) Then
                Send("2")
                Sleep(1000)
            EndIf
            ; USE SKILL 7 (mine is combo sword attack (5hits)) UNLESS MONSTER IS ALMOST DOWN
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(475, 45) = 16743291) Then
                Send("1")
                Sleep(1000)
            EndIf
            ; USE IMBUE SKILL (mine is skill 2) UNLESS MONSTER IS ALMOST DOWN
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(475, 45) = 16743291) Then
                Send("3")
                Sleep(1000)
            EndIf
            ; USE SKILL 5 (mine is sword attack, stab and smash)UNLESS MONSTER IS CLOSE TO DYING
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(442, 45) = 16762566) Then
                Send("4")
                Sleep(1000)
            EndIf
            ;THIS WILL TRY AND PICK UP ANYTHING EVEN IF YOU WALK PASSED SOME GOLD
            Send("g"); CHECK WICH KEY TO USE IN SILKROAD OPTIONS !!
            Sleep(1000); DEFAULT GRABKEY IN SILKROAD IS "G"
        EndIf
    WEnd
EndFunc   ;==>attack

Func Pause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
    WEnd
EndFunc   ;==>Pause

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

Link to comment
Share on other sites

HotKeySet("{PAUSE}", "Pause")
Global $Paused

$Click = _FindMonster()
MouseClick('left', $click[0], $click[1], 1, 0)
Attack()

; --------------------------------------------------
;  Function:        _FindMonster()
;  Arguments:        None
;  Returns:            Array with click coordinates to select a monster
;                         $array[0] - Xcoord    $array[1] - Ycoord
;  Author:            djingis1
;  Description:       Finds a monster and returns coords to click
;                         Note: SRO RESOLUTION 800*600 REQUIRED
; --------------------------------------------------

Func _FindMonster()
    Dim $iCoord
    While 1
        $iCoord = PixelSearch(250, 225, 374, 274, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(375, 225, 474, 274, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(415, 275, 474, 359, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(375, 360, 474, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(250, 225, 374, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(250, 175, 474, 224, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(475, 175, 574, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 400, 424, 474, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 175, 259, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 100, 664, 174, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        ; The sleep is there to prevent the PixelSearches
        ; from lagging the script a lot if a monster is not found
        ; in the first loop
        Sleep(250)
    WEnd
    $iCoord[0] = $iCoord[0] + 4
    $iCoord[1] = $iCoord[1] + 4
    Return $iCoord
EndFunc   ;==>_FindMonster

Func Attack()
    While 1
        If WinActive("SRO_Client") And PixelGetColor(77, 47) = 3947324 Then;IF ACTIVE AND INGAME
            ; USE SKILL 1 (mine is sword attack, strike and smash) UNLESS MONSTER IS CLOSE TO DYING
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(442, 45) = 16762566) Then
                Send("2")
                Sleep(1000)
            EndIf
            ; USE SKILL 7 (mine is combo sword attack (5hits)) UNLESS MONSTER IS ALMOST DOWN
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(475, 45) = 16743291) Then
                Send("1")
                Sleep(1000)
            EndIf
            ; USE IMBUE SKILL (mine is skill 2) UNLESS MONSTER IS ALMOST DOWN
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(475, 45) = 16743291) Then
                Send("3")
                Sleep(1000)
            EndIf
            ; USE SKILL 5 (mine is sword attack, stab and smash)UNLESS MONSTER IS CLOSE TO DYING
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(442, 45) = 16762566) Then
                Send("4")
                Sleep(1000)
            EndIf
            ;THIS WILL TRY AND PICK UP ANYTHING EVEN IF YOU WALK PASSED SOME GOLD
            Send("g"); CHECK WICH KEY TO USE IN SILKROAD OPTIONS !!
            Sleep(1000); DEFAULT GRABKEY IN SILKROAD IS "G"
        EndIf
    WEnd
EndFunc   ;==>attack

Func Pause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
    WEnd
EndFunc   ;==>Pause

Fixed-

Link to comment
Share on other sites

HotKeySet("{PAUSE}", "Pause")
Global $Paused

While 1
    $Click = _FindMonster()
    MouseClick('left', $click[0], $click[1], 1, 0)
    Attack()
WEnd

; --------------------------------------------------
;  Function:        _FindMonster()
;  Arguments:        None
;  Returns:            Array with click coordinates to select a monster
;                         $array[0] - Xcoord    $array[1] - Ycoord
;  Author:            djingis1
;  Description:       Finds a monster and returns coords to click
;                         Note: SRO RESOLUTION 800*600 REQUIRED
; --------------------------------------------------

Func _FindMonster()
    Dim $iCoord
    While 1
        $iCoord = PixelSearch(250, 225, 374, 274, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(375, 225, 474, 274, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(415, 275, 474, 359, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(375, 360, 474, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(250, 225, 374, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(250, 175, 474, 224, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(475, 175, 574, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 400, 424, 474, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 175, 259, 399, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        $iCoord = PixelSearch(0, 100, 664, 174, 0xFF00FF, 25, 1)
        If @error <> 1 Then ExitLoop
        ; The sleep is there to prevent the PixelSearches
        ; from lagging the script a lot if a monster is not found
        ; in the first loop
        Sleep(250)
    WEnd
    $iCoord[0] = $iCoord[0] + 4
    $iCoord[1] = $iCoord[1] + 4
    Return $iCoord
EndFunc   ;==>_FindMonster

Func Attack()
    While 1
        If WinActive("SRO_Client") And PixelGetColor(77, 47) = 3947324 Then;IF ACTIVE AND INGAME
            ; USE SKILL 1 (mine is sword attack, strike and smash) UNLESS MONSTER IS CLOSE TO DYING
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(442, 45) = 16762566) Then
                Send("2")
                Sleep(1000)
            EndIf
            ; USE SKILL 7 (mine is combo sword attack (5hits)) UNLESS MONSTER IS ALMOST DOWN
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(475, 45) = 16743291) Then
                Send("1")
                Sleep(1000)
            EndIf
            ; USE IMBUE SKILL (mine is skill 2) UNLESS MONSTER IS ALMOST DOWN
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(475, 45) = 16743291) Then
                Send("3")
                Sleep(1000)
            EndIf
            ; USE SKILL 5 (mine is sword attack, stab and smash)UNLESS MONSTER IS CLOSE TO DYING
            if (PixelGetColor(605, 23) = 14077580 And PixelGetColor(442, 45) = 16762566) Then
                Send("4")
                Sleep(1000)
            EndIf
            ;THIS WILL TRY AND PICK UP ANYTHING EVEN IF YOU WALK PASSED SOME GOLD
            Send("g"); CHECK WICH KEY TO USE IN SILKROAD OPTIONS !!
            Sleep(1000); DEFAULT GRABKEY IN SILKROAD IS "G"
        EndIf
    WEnd
EndFunc   ;==>attack

Func Pause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
    WEnd
EndFunc   ;==>Pause

Loop added-

Link to comment
Share on other sites

Hi,

ahhhh haven't looked closer. Now the script makes sense. Find monster --> attack --> find monster --> attack ... pause :whistle:

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

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...