Jump to content

plz help with finishing script


1hit
 Share

Recommended Posts

hi im making this script and now im trying to make it loop so it keeps running untill i close it

(any other things that may help would be nice too).

this script is for a game and it finds the pixels of a monster in a small area just around my character and it is supposed to double click on the monster and then find anotehr one and keep clicking on them(it takes about 8 seconds to kill each monster.

heres wat i have so far:

; Script Start - Add your code below here
WinActivate ( 'SRO_Client' )
Sleep ( 500 )
$coord = PixelSearch(298,240,398,310, 0xAE7253, )
  MouseMove($coord[0],$coord[1],0) = 1
    Sleep(500)
    MouseClick("left")($coord[0],$coord[1],0)
Sleep(500)
MouseClick("left")($coord[0],$coord[1],0)
sleep(1000)
End

thx bye :P

Edited by 1hit
Link to comment
Share on other sites

maybe try Hotkeyset() This script usees HOME and END

HOME - Toggle on/off

End - Exit

Btw, Welcome to Autoit forums.

Hotkeyset("{HOME}","start")
Hotkeyset("{END}","stop")

Global $stop

Func start()
WinActivate ( 'SRO_Client' )
Sleep ( 500 )
$stop = NOT $stop
While $stop
; Script Start - Add your code below here

$coord = PixelSearch(298,240,398,310, 0xAE7253, )
  MouseMove($coord[0],$coord[1],0) = 1
    Sleep(500)
    MouseClick("left")($coord[0],$coord[1],0)
Sleep(500)
MouseClick("left")($coord[0],$coord[1],0)
sleep(1000)
End
WEnd
EndFunc

Func stop()
Exit
EndFunc

While 1
Sleep(50)
WEnd
Edited by NegativeNrG

[size=20]My File Upload[/size]Register at my site and upload.

Link to comment
Share on other sites

cool thx for helping

i used ur script and i got this error:

line 26

MouseMove($coord[0],$coord[1],0)=1
MouseMove($coord^ERROR

Error: Subscript used with non-array variable

anyone know wat is wrong cuz im totally lost lol

Edited by 1hit
Link to comment
Share on other sites

  • Moderators

This looks a bit weird..: MouseClick("left")($coord[0],$coord[1],0)

1. MouseClick was closed off after 'left'.

2. Where the ,0 is, is how many times to 'click', that's set to '0'.

Try this: Read the Help File for Opt("PixelCoordMode") and Opt("MouseCoordMode") for the correct settings.

Opt("MouseCoordMode", 2); Read the help file for "Opt" to see if you need to keep the '2' a '2', '1', or '0'
Opt("PixelCoordMode", 2); Read the help file for "Opt" to see if you need to keep the '2' a '2', '1', or '0'
Hotkeyset("{HOME}","start")
Hotkeyset("{END}","stop")

Global $stop

Func start()
WinActivate ( 'SRO_Client' )
Sleep ( 500 )
$stop = NOT $stop
While $stop
; Script Start - Add your code below here

$coord = PixelSearch(298,240,398,310, 0xAE7253, )
If Not @error And IsArray($coord) Then
Sleep(500)
MouseClick("left", $coord[0],$coord[1],1, 1)
Sleep(500)
MouseClick("left", $coord[0],$coord[1],1, 1)
Sleep(1000)
EndIf
WEnd
EndFunc

Func stop()
Exit
EndFunc

While 1
Sleep(50)
WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Maybe this will get you started?

HotKeySet("{ESC}","Stop")
Msgbox(0,"Ready?","Press OK when you're ready to start.")
Sleep(1000)

Func start()
WinActivate ( 'SRO_Client' )
Sleep (500)

While 1
$coord = PixelSearch(298,240,398,310, 0xAE7253)
If Not @error Then
; Mouse moves instantly to the color and left clicks two times
    MouseClick("left", $coord[0], $coord[1], 2, 0)
; Waits 8 seconds for the monster to die
    Sleep(8000)
EndIf   
WEnd
EndFunc

Func stop()
Exit
EndFunc
Edited by big_daddy
Link to comment
Share on other sites

thx for helping everyone

its for silkroad online

and i tried all of your scripts but none of them will activate the window it just does nothing lol

o nvm sm0ken's script works gotta see if it attacks the guys now

well its not attacking lol and i cant tell if its not finding the pixel color or anything, is there some way u can make it so it can search for colors that are pretty close too the one i picked? im really new to autoit this is my first script so dont know very much about it lol.

this is what im fighting by the way. Posted Image

Edited by 1hit
Link to comment
Share on other sites

someone plz help i dont know why its not finding the monster and clicking on it. i was wondering if tehre is a monster color tolerance or soemthing that makes it search for the color i put but if its close then it will work too.

this is wat i got so far:

; Script Start - Add your code below here
Opt("MouseCoordMode", 1); Read the help file for "Opt" to see if you need to keep the '2' a '2', '1', or '0'
Opt("PixelCoordMode", 2); Read the help file for "Opt" to see if you need to keep the '2' a '2', '1', or '0'
Hotkeyset("{HOME}","start")
Hotkeyset("{END}","stop")

Global $stop

Func start()
WinActivate ( 'SRO_Client' )
Sleep ( 500 )
$stop = NOT $stop
While $stop
; Script Start - Add your code below here

$coord = PixelSearch(298,240,398,310, 0xAE7253)
If Not @error And IsArray($coord) Then
Sleep(500)
MouseClick("left", $coord[0],$coord[1],2, 0)
Sleep(6000)
EndIf
WEnd
EndFunc

Func stop()
Exit
EndFunc

While 1
Sleep(50)
WEnd

plz help im new to autoit and i cant figure it out lol

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