Jump to content

Need Help With Writing a Script


Recommended Posts

Hi, guys.I'm new in the forum.Sorry for the stupid post but i'm actually don't understand the program quiet well.My question is that, is there possibility anybody to write me a script.I think that the script wouldn't be long.I need AutoIT to scan area of the screen for a color and when the color pop up the script to click at left shift button.I use resolution 800x600 and the scan area have to be 370-420 at X and 110-160 at Y coordinates.Thanks in advance people.

Link to comment
Share on other sites

Some great functions to use:

PixelSearch()

MouseClick()

Send()

Check the helpfile on these, and read up about them!

A Example:

$Color = color goes here...

While 1
$Pixel = PixelSearch(370, 420, 110, 160, $Color, 5)
Send("{Shift Down}")
MouseClick("left", $Pixel[0], $Pixel[1])
Send("{Shift Up}")
WEnd

Warning: The above code may not work. It is an example to show you how to do this.

Link to comment
Share on other sites

Well a minute before read your post i write something like that you post here.

;NFS Underground 2
While 1
$Pixel = PixelSearch( 370, 420, 110, 160, 0x00FE00)
Send("LSHIFT")
Wend

But when i start that script if it gets the color in the scan area it starts to push SHIFT and never stops.

Is there any way to avoid that?

Link to comment
Share on other sites

Finally i wrote a code that works but not full functionally.

WinWaitActive("NFS Underground 2 - Window Mode By Wiccaan")
While 1
$pixel=PixelSearch(0,0,800,600,0x00FE00)
If IsArray($pixel) = 1 Then
Send("{LSHIFT}")
EndIf
WEnd

Is there a way to speed up the things because when i start the script my pc lags...

I stop everything except the game and the script.I make the game 640x480 and low the graphic details and still when i run the script my pc lags.It cant respond as quickly as i want to :) Is there any way to avoid that lag?

I think i have to make the script to scan not the full screen but only the spot with exact color but i don't know how.

Can anyone help me?

Edited by rosenman
Link to comment
Share on other sites

I look the code for PixelSearch:

PixelSearch ( left, top, right, bottom, color , shade-variation , step , hwnd )

Than i Fill it up.

Left pixel = 460

Top pixel = 165

Right Pixel = 465

Bottom pixel = 170

Color = 0x00FE00

PixelSearch (460,165,465,170,0x00FE00)

And this not works for me.When i change it to

PixelSearch (0,0,465,170,0x00FE00)

Than it works but still slow down the pc.

How to make the PixelSearch to search only in this 5 pixel square

from X axis 460-465 and Y axis 165-170.

Please help.

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