Jump to content

I feel so alone with Pixelsearch.. Can you help me ?


Recommended Posts

Bonjour je suis français :) , Hi there i'm french and i need so help please.

I have a 1280 x 800 screen and i try to locate(localize) the coordinates of a rectangle to use them with PixelSearch.

I use for it XnView with whom(which) I drew a rectangle to determine the zone to look for with Pixelsearch.

But I do not arrive, to interpret the information which gives me Autoit Window Info...

Here are the information of coordinates for Top Left area :

Posted Image

Here are the information of coordinates for Bottom Right area :

Posted Image

And if i understood well what is said here :

Top = X Coord Top Left of the beginning area to search

Left = Y Coord Top Left of the beginning area to search

Right = X Coord Bottom Right of End of Area to search

Bottom = Y Coord Bottom Right of End of Area to search

So you have 2 points of access, the beginning x and y coord, and the ending x and y coord of an area to search.

I thus try to specify this information for Pixelsearch :

;SciTE Version 1.76 Mar 30 2008 21:05:14

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("Guild Wars","")
If Not WinActive("Guild Wars","") Then WinActivate("Guild Wars","")
WinWaitActive("Guild Wars","")

Sleep(2000)

$Found = 0

Send("{Alt Down}")

Sleep(500)

While $Found = 0
    $Coord = PixelSearch( 105, 350, 900, 380, 0x99FF00 )
    If NOT @Error Then
        $Found = 1
    EndIf
wEnd

Send("{Alt Up}")

MouseClick("Left", $Coord[0], $Coord[1],1)

And tried also this :

While $Found = 0
    $Coord = PixelSearch( 350, 105, 900, 380, 0x99FF00 )
    If NOT @Error Then
        $Found = 1
    EndIf
wEnd

NPC.au3

When I launch the macro it does not work... :P What is the problem? How to interpreter clearly the information of Autoit Window Info to determine the coordinates of a rectangle with the aim of the use with Pixelsearch?

All this adorned me complicated well seen my poor level in computing and I shall infinitely be grateful to you for helping me.

Thank you for your help and forgive please the poverty :P of my English...

Edited by SimpleWorker
I am a simple worker, but I do my best
Link to comment
Share on other sites

Here is an AutoMiner that was made for runescape with AutoIt, by Manadar. It helped me understand alot about pixelsearch, and it also has this function that you are asking for. Have a look, enjoy, good luck, and feel free to ask more questions if needed. :)


I hope it does you just as much good.

#NoTrayIcon
#include <GUIConstants.au3>

#include <Misc.au3>

#include <WindowsConstants.au3>

#include <StaticConstants.au3>

#include <EditConstants.au3>

HotKeySet("!^x", "Abort")

Global $CurrentColor = "0xAF0000"

Global $StartX = IniRead("MineData.ini", "Pos", "X",0)

Global $StartY = IniRead("MineData.ini", "Pos", "Y",0)

Global $x = $StartX, $y = $StartY

Global $ScanWidth = 110, $ScanHeight = 120

Global $T1[5],$T2[5]

Global $SleepCheck = 500, $SleepMine = 4000

Global $Idle = 0

Global $MoveMode = True

Global $AppTitle = "RS Auto-Miner"

Global $ColorClay = IniRead("MineData.ini", "Colors", "Clay", "?")

Global $ColorCopper = IniRead("MineData.ini", "Colors", "Copper", 9003840)

Global $ColorTin = IniRead("MineData.ini", "Colors", "Tin", 7432553)

Global $ColorIron = IniRead("MineData.ini", "Colors", "Iron", 4072732)

Global $ColorSilver = IniRead("MineData.ini", "Colors", "Silver", 16777215)

Global $ColorCoal = IniRead("MineData.ini", "Colors", "Coal", 3815975)

Global $ColorGold = IniRead("MineData.ini", "Colors", "Gold", 10193720)

Global $ColorMithril = IniRead("MineData.ini", "Colors", "Mithril", 5329529)

Global $ColorAddy = IniRead("MineData.ini", "Colors", "Addy", "?")

Global $ColorRunite = IniRead("MineData.ini", "Colors", "Runite", "?")

;beta below

Global $Sens = IniRead("MineData.ini", "Beta", "Sensitifity", 8)

Global $AverageX, $AverageY, $i

$GUI = GUICreate($AppTitle,110,40,$x,$y,$WS_POPUP)

$ColorLabel = GUICtrlCreateLabel("Color",0,1,110,20,$SS_CENTER)

SetColor()

$Sleep = GUICtrlCreateEdit("Stopped", 0, 20,110,20,$ES_AUTOVSCROLL+$ES_AUTOHSCROLL+$ES_READONLY+$ES_CENTER)

GUICtrlSetBkColor(-1,0xFFFFFF)

GUISetState()

WinSetOnTop($GUI,"",1)

$menu = GUICtrlCreateContextMenu ($ColorLabel)

$Start = GUICtrlCreateMenuitem ("Start!", $menu,-1,1)

$Stop = GUICtrlCreateMenuitem ("Stop", $menu,-1,1)

GUICtrlSetState(-1,$GUI_CHECKED)

GUICtrlCreateMenuitem ("",$menu)

$Time1Menu = GUICtrlCreateMenu ("Check Interval", $menu)

$T1[0] = GUICtrlCreateMenuitem ("200 ms", $Time1Menu,-1,1)

$T1[1] = GUICtrlCreateMenuitem ("500 ms", $Time1Menu,-1,1)

GUICtrlSetState(-1,$GUI_CHECKED)

$T1[2] = GUICtrlCreateMenuitem ("1 sec", $Time1Menu,-1,1)

$T1[3] = GUICtrlCreateMenuitem ("2 sec", $Time1Menu,-1,1)

$T1[4] = GUICtrlCreateMenuitem ("Custom", $Time1Menu,-1,1)

$Time2Menu = GUICtrlCreateMenu ("Mine Interval", $menu)

$T2[0] = GUICtrlCreateMenuitem ("1 sec", $Time2Menu,-1,1)

$T2[1] = GUICtrlCreateMenuitem ("2 sec", $Time2Menu,-1,1)

$T2[2] = GUICtrlCreateMenuitem ("4 sec", $Time2Menu,-1,1)

GUICtrlSetState(-1,$GUI_CHECKED)

$T2[3] = GUICtrlCreateMenuitem ("6 sec", $Time2Menu,-1,1)

$T2[4] = GUICtrlCreateMenuitem ("Custom", $Time2Menu,-1,1)

GUICtrlCreateMenuitem ("",$menu)

$move = GUICtrlCreateMenuitem ("Move Screen", $menu)

$Resize = GUICtrlCreateMenuitem ("Set Scansize", $menu)

$Colormenu = GUICtrlCreateMenu ("Select Color", $menu)

$Pick = GUICtrlCreateMenuitem ("By Screen Color", $Colormenu)

$OreMenu = GUICtrlCreateMenu ("By Ore", $Colormenu)

$MenuClay = GUICtrlCreateMenuitem ("Clay", $OreMenu)

$MenuTin = GUICtrlCreateMenuitem ("Tin", $OreMenu)

$MenuCopper = GUICtrlCreateMenuitem ("Copper", $OreMenu)

$MenuIron = GUICtrlCreateMenuitem ("Iron", $OreMenu)

$MenuSilver = GUICtrlCreateMenuitem ("Silver", $OreMenu)

$MenuCoal = GUICtrlCreateMenuitem ("Coal", $OreMenu)

$MenuGold = GUICtrlCreateMenuitem ("Gold", $OreMenu)

$MenuMithril = GUICtrlCreateMenuitem ("Mithril", $OreMenu)

$MenuAddy = GUICtrlCreateMenuitem ("Adamantite", $OreMenu)

$MenuRunite = GUICtrlCreateMenuitem ("Runite", $OreMenu)

GUICtrlCreateMenuitem ("",$menu)

$Preferences = GUICtrlCreateMenuitem ("Preferences", $menu)

$Help = GUICtrlCreateMenuitem ("Help", $menu)

GUICtrlCreateMenuitem ("",$menu)

$Exit = GUICtrlCreateMenuitem ("Exit", $menu)

$Top = GUICreate("Top Line", $ScanWidth, 2,$x,$y + 40,$WS_POPUP,-1,$GUI)

GUISetBkColor(0xFF0000)

GUISetState()

$Left = GUICreate("Left Line", 2, $ScanHeight,$x,$y + 40,$WS_POPUP,-1,$GUI)

GUISetBkColor(0xFF0000)

GUISetState()

$Right = GUICreate("Right Line", 2, $ScanHeight,$x + $ScanWidth - 2,$y + 40,$WS_POPUP,-1,$GUI)

GUISetBkColor(0xFF0000)

GUISetState()

$Bottom = GUICreate("Bottom Line", $ScanWidth, 2,$x,$y + 40 + $ScanHeight,$WS_POPUP,-1,$GUI)

GUISetBkColor(0xFF0000)

GUISetState()

HotKeySet("^f","DisplayColor")

HotKeySet("^z","Start")

HotKeySet("^x","Stop")

HotKeySet("^x","Stop")

HotKeySet("^a","Move")

While 1

$msg = GUIGetMsg()

Select

Case $msg = $Start

Check()

Case $msg = $Stop

AdlibDisable()

GUICtrlSetData($Sleep,"Stopped")

Case $msg = $ColorLabel

$NewColor = _ChooseColor(2,$CurrentColor,2)

If Not @error Then

$CurrentColor = $NewColor

SetColor()

EndIf

Case $msg = -3

Exit

Case $msg = $move

Stop()

$MoveMode = True

While 1

$MousePos = MouseGetPos()

WinMove($GUI,"", $MousePos[0],$MousePos[1])

WinMove($Top,"", $MousePos[0],$MousePos[1]+40)

WinMove($Left,"", $MousePos[0],$MousePos[1]+40)

WinMove($Right,"", $MousePos[0]+ $ScanWidth - 2,$MousePos[1]+40)

WinMove($Bottom,"", $MousePos[0],$MousePos[1]+ 40 + $ScanHeight)

$x = $MousePos[0]

$y = $MousePos[1]

If _IsPressed(01) Then

ExitLoop

EndIf

WEnd

Case $msg = $Pick

While 1

$MousePos = MouseGetPos()

If Not @error Then

$NewColor = PixelGetColor($MousePos[0],$MousePos[1])

GUICtrlSetBkColor($ColorLabel,$NewColor)

GUISetBkColor($NewColor,$GUI)

EndIf

Sleep(200)

If _IsPressed(01) Then

ExitLoop

EndIf

WEnd

If $NewColor <> -1 Then

$CurrentColor = $NewColor

EndIf

SetColor()

Case $msg = $Resize

Resize()

Case $msg = $Preferences

Preferences()

Case $msg = $Exit

Exit

Case $msg = $T1[0]

$SleepCheck = 200

Case $msg = $T1[1]

$SleepCheck = 500

Case $msg = $T1[2]

$SleepCheck = 1000

Case $msg = $T1[3]

$SleepCheck = 2000

Case $msg = $T1[4]

$Input = Number(InputBox("Custom Checking Time", "How many ms do you want to wait?", $SleepCheck,"", 200,162,$x+111,$y))

If (Not @error) AND (IsNumber($Input)) AND ($Input <> 0) Then

$SleepCheck = Round($Input)

Else

$SleepCheck = 500

GUICtrlSetState($T1[1],$GUI_CHECKED)

GUICtrlSetState($T1[4],$GUI_UNCHECKED)

EndIf

Case $msg = $T2[0]

$SleepMine = 1000

Case $msg = $T2[1]

$SleepMine = 2000

Case $msg = $T2[2]

$SleepMine = 4000

Case $msg = $T2[3]

$SleepMine = 6000

Case $msg = $T2[4]

$Input = Number(InputBox("Custom Mining Time", "How many ms do you want to wait?", $SleepMine,"", 200,162,$x+111,$y))

If (Not @error) AND (IsNumber($Input)) AND ($Input <> 0) Then

$SleepMine = Round($Input)

Else

$SleepMine = 4000

GUICtrlSetState($T2[3],$GUI_CHECKED)

GUICtrlSetState($T2[4],$GUI_UNCHECKED)

EndIf

Case $msg = $MenuClay

$CurrentColor = $ColorClay

SetColor()

Case $msg = $MenuTin

$CurrentColor = $ColorTin

SetColor()

Case $msg = $MenuCopper

$CurrentColor = $ColorCopper

SetColor()

Case $msg = $MenuIron

$CurrentColor = $ColorIron

SetColor()

Case $msg = $MenuSilver

$CurrentColor = $ColorSilver

SetColor()

Case $msg = $MenuCoal

$CurrentColor = $ColorCoal

SetColor()

Case $msg = $MenuGold

$CurrentColor = $ColorGold

SetColor()

Case $msg = $MenuMithril

$CurrentColor = $ColorMithril

SetColor()

Case $msg = $MenuAddy

$CurrentColor = $ColorAddy

SetColor()

Case $msg = $MenuRunite

$CurrentColor = $ColorRunite

SetColor()

EndSelect

WEnd

Func Check()

Sleep(Random(0,500,1))

$Pixel = PixelSearch($x+2,$y+42,$x+2+$ScanWidth,$y+42+$ScanHeight,$CurrentColor,$Sens)

If Not @error Then

MouseClick("Left", $Pixel[0],$Pixel[1],1,2)

GUICtrlSetData($Sleep,"Mining | " & $SleepMine & " ms")

$Idle = 0

AdlibEnable("Check", $SleepMine)

Else

GUICtrlSetData($Sleep,"Checking | " & $SleepCheck & " ms")

$Idle += $SleepCheck

If $Idle >= 60000 Then

MouseClick("Left")

$Idle = 0

EndIf

AdlibEnable("Check", $SleepCheck)

EndIf

EndFunc

Func DisplayColor()

InputBox("Copy & Paste Box", "This is the variable $CurrentColor:", $CurrentColor)

EndFunc

Func Resize()

HotKeySet("^a")

Stop()

$MoveMode = True

While 1

$MousePos = MouseGetPos()

WinMove($Top,"", $x,$y+40,$ScanWidth,2)

WinMove($Left,"", $x,$y+40,2,$ScanHeight)

WinMove($Right,"", $x+ $ScanWidth - 2,$y+40,2,$ScanHeight)

WinMove($Bottom,"", $x,$y+ 40 + $ScanHeight,$ScanWidth,2)

If Not (($MousePos[0] - $x + 1) <= 40) Then

$ScanWidth = $MousePos[0] - $x + 1

EndIf

If Not (($MousePos[1] - $y - 39) <= 40) Then

$ScanHeight = $MousePos[1] - $y - 39

EndIf

If _IsPressed(01) Then

ExitLoop

EndIf

WEnd

HotKeySet("^a","Move")

EndFunc

Func SetColor()

GUICtrlSetBkColor($ColorLabel,$CurrentColor)

GUISetBkColor($CurrentColor,$GUI)

EndFunc

Func Abort()

AdlibDisable()

HotKeySet("!^x")

SplashTextOn("Alert", "Emergency Exit", 200,30)

Sleep(800)

Exit

EndFunc

Func Start()

Check()

GUICtrlSetState($Stop,$GUI_UNCHECKED)

GUICtrlSetState($Start,$GUI_CHECKED)

EndFunc

Func Stop()

AdlibDisable()

GUICtrlSetData($Sleep,"Stopped")

AdlibDisable()

GUICtrlSetData($Sleep,"Stopped")

GUICtrlSetState($Stop,$GUI_CHECKED)

GUICtrlSetState($Start,$GUI_UNCHECKED)

EndFunc

Func Move()

If $MoveMode Then

Stop()

SetProgramPos($StartX,$StartY)

Else

SetProgramPos($x,$y)

EndIf

$MoveMode = Not $MoveMode

EndFunc

Func SetProgramPos($x,$y)

WinMove($GUI,"", $x,$y)

WinMove($Top,"", $x,$y+40)

WinMove($Left,"", $x,$y+40)

WinMove($Right,"", $x+ $ScanWidth - 2,$y+40)

WinMove($Bottom,"", $x,$y+ 40 + $ScanHeight)

EndFunc

Func Preferences()

Stop()

$Pref = GUICreate("Preferences", 453, 462)

; Left side

GUICtrlCreateLabel("The colors " & $AppTitle & " looks for are below." & @CRLF & "The color can be a hex or a decimal. To get a color use the ""Select Color > By Screen Color"" mode and press ""Ctrl + F""", 5, 5, 233, 52)

GUICtrlCreateGroup("Colors", 0, 55, 240, 285)

$InputClay = GUICtrlCreateInput($ColorClay, 105, 75, 121, 21)

GUICtrlCreateLabel("Clay", 10, 80, 43, 17)

$InputCopper = GUICtrlCreateInput($ColorCopper, 105, 100, 121, 21)

GUICtrlCreateLabel("Copper", 10, 105, 53, 17)

$InputTin = GUICtrlCreateInput($ColorTin, 105, 125, 121, 21)

GUICtrlCreateLabel("Tin", 10, 130, 53, 17)

$InputIron = GUICtrlCreateInput($ColorIron, 105, 150, 121, 21)

GUICtrlCreateLabel("Iron", 10, 155, 53, 17)

$InputSilver = GUICtrlCreateInput($ColorSilver, 105, 175, 121, 21)

GUICtrlCreateLabel("Silver", 10, 180, 53, 17)

$InputCoal = GUICtrlCreateInput($ColorCoal, 105, 200, 121, 21)

GUICtrlCreateLabel("Coal", 10, 205, 53, 17)

$InputGold = GUICtrlCreateInput($ColorGold, 105, 225, 121, 21)

GUICtrlCreateLabel("Gold", 10, 230, 53, 17)

$InputMithril = GUICtrlCreateInput($ColorMithril, 105, 250, 121, 21)

GUICtrlCreateLabel("Mithril", 10, 255, 53, 17)

$InputAddy = GUICtrlCreateInput($ColorAddy, 105, 275, 121, 21)

GUICtrlCreateLabel("Adamantite", 10, 280, 53, 17)

$InputRunite = GUICtrlCreateInput($ColorRunite, 105, 300, 121, 21)

GUICtrlCreateLabel("Runite", 10, 305, 53, 17)

GUICtrlCreateLabel("These represent the starting point for the program. They are also the coordinates used with Ctrl + A.", 0, 345, 239, 47)

GUICtrlCreateGroup("X and Y", 0, 380, 240, 50)

$InputX = GUICtrlCreateInput($StartX, 30, 400, 86, 21)

$InputY = GUICtrlCreateInput($StartY, 120, 400, 86, 21)

;Right side

GUICtrlCreateLabel("The right side contains Beta functions only. These are more advanced and may cause unexplainable errors.", 245, 5, 204, 42)

GUICtrlCreateGroup("Beta Options", 245, 55, 205, 285)

$CenterCheckbox = GUICtrlCreateCheckbox("", 255, 75, 187, 17)

$ColorCheckbox = GUICtrlCreateCheckbox("", 255, 100, 187, 17)

GUICtrlCreateLabel("Color match sensitivity. Move the slider to the left for a harder match.", 255, 125, 179, 27)

$SensSlider = GUICtrlCreateSlider(255, 155, 180, 30)

GUICtrlSetLimit(-1,20,1)

GUICtrlSetData(-1,$Sens)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateGroup("Drop Options", 250, 245, 195, 85)

$DropNormal = GUICtrlCreateRadio("", 260, 265, 113, 17)

$DropMagic = GUICtrlCreateRadio("", 260, 285, 113, 17)

$DropNone = GUICtrlCreateRadio("No Drop (Default)", 260, 305, 113, 17)

GUICtrlSetState(-1,$GUI_CHECKED)

GUICtrlCreateGroup("", -99, -99, 1, 1)

;Bottom Buttons

$DefaultButton = GUICtrlCreateButton("Default Values", 5, 435, 135, 25)

$OkButton = GUICtrlCreateButton("OK", 145, 435, 90, 25)

GUICtrlSetState(-1,$GUI_FOCUS)

GUISetState(@SW_SHOW)

WinSetOnTop($Pref, "", 1)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $OkButton

IniWrite("MineData.ini", "Colors", "Clay", GUICtrlRead($InputClay))

IniWrite("MineData.ini", "Colors", "Copper", GUICtrlRead($InputCopper))

IniWrite("MineData.ini", "Colors", "Tin", GUICtrlRead($InputTin))

IniWrite("MineData.ini", "Colors", "Iron", GUICtrlRead($InputIron))

IniWrite("MineData.ini", "Colors", "Silver", GUICtrlRead($InputSilver))

IniWrite("MineData.ini", "Colors", "Coal", GUICtrlRead($InputCoal))

IniWrite("MineData.ini", "Colors", "Gold", GUICtrlRead($InputGold))

IniWrite("MineData.ini", "Colors", "Mithril", GUICtrlRead($InputMithril))

IniWrite("MineData.ini", "Colors", "Addy", GUICtrlRead($InputAddy))

IniWrite("MineData.ini", "Colors", "Runite", GUICtrlRead($InputRunite))

IniWrite("MineData.ini", "Pos", "X", GUICtrlRead($InputX))

IniWrite("MineData.ini", "Pos", "Y", GUICtrlRead($InputY))

$ColorClay = GUICtrlRead($InputClay)

$ColorCopper = GUICtrlRead($InputCopper)

$ColorTin = GUICtrlRead($InputTin)

$ColorIron = GUICtrlRead($InputIron)

$ColorSilver = GUICtrlRead($InputSilver)

$ColorCoal = GUICtrlRead($InputCoal)

$ColorGold = GUICtrlRead($InputGold)

$ColorMithril = GUICtrlRead($InputMithril)

$ColorAddy = GUICtrlRead($InputAddy)

$ColorRunite = GUICtrlRead($InputRunite)

;beta below

If GUICtrlRead($CenterCheckbox) = $GUI_CHECKED Then

IniWrite("MineData.ini", "Beta", "CenterOnOre", 1)

ElseIf GUICtrlRead($CenterCheckbox) = $GUI_UNCHECKED Then

IniWrite("MineData.ini", "Beta", "CenterOnOre", 0)

EndIf

If GUICtrlRead($ColorCheckbox) = $GUI_CHECKED Then

IniWrite("MineData.ini", "Beta", "ColorAverage", 1)

ElseIf GUICtrlRead($ColorCheckbox) = $GUI_UNCHECKED Then

IniWrite("MineData.ini", "Beta", "ColorAverage", 0)

EndIf

$Sens = GUICtrlRead($SensSlider)

IniWrite("MineData.ini", "Beta", "Sensitifity", $Sens)

ExitLoop

Case $msg = $DefaultButton

FileDelete("MineData.ini")

MsgBox(0, $AppTitle, "Default values set, please restart " & $AppTitle)

Exit

EndSelect

WEnd

GUIDelete()

EndFunc

And the Readme:

RuneScape AutoMiner v1.0
Introduction:

Welcome to RuneScape AutoMiner's helpfile. You're already one step

into the right direction: You are reading this manual. This manual

is a short guide to how you should use this AutoMiner.

Steps:

1. Start RuneScape and log in, head for a mining area and get a pickaxe.

2. Start the AutoMiner.

3. Select the Color of the Ore you want to mine.

(Rightclick the word Color and a menu will drop down)

(Note: Some Colors/Ores are still not supported)

4. Move the AutoMiner over the ores that you want to mine. And

set the required 'Scan Size'. (Area the script will look in

for this color you've just set)

5. Set the 2 timers: One controling the interval between checks,

the other controling the time before another check is done while

mining.

6. Either click 'Start' or press Ctrl + z

7. Sit back, hopefully relax.

8. Wait until you have the required amount of ores (likely, a full inventory).

9. Return to the bank, go to the mining zone and repeat the process from step 6.

Hotkeys:

Ctrl + Alt + x Emergency Exit (used for debugging)

Ctrl + z Starts the autominer.

Ctrl + x Stops the autominer. (Pause)

Ctrl + a Puts the AutoMiner in the left top corner.

When pressed again it moves the AutoMiner back to the original position.

Footnote:

The RuneScape AutoMiner, you will likely have found with this document,

and this help file are fully owned by Manadar. All

rights restricted, except study.

P.S. Zee Germans Are Coming :P hehe, kidding mate, good luck :P

Edited by Melba23
Removed user name by request
children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Link to comment
Share on other sites

Anonymouse said:

Here is an AutoMiner that was made for runescape with AutoIt, by Manadar. It helped me understand alot about pixelsearch, and it also has this function that you are asking for. Have a look, enjoy, good luck, and feel free to ask more questions if needed. :P

I hope it does you just as much good.

Thank you very much for your participation, but it does not regrettably help me a lot... :) I would like to have a much simpler answer if possible. But better than an answer, an explanation. :P

Edited by Melba23
Removed user name by request
I am a simple worker, but I do my best
Link to comment
Share on other sites

pixelsearch should be in the following format: PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )

Your second example looked correct, although you chopped a bit off of the right and bottom by rounding down instead of up.

Also, if that exact pixel color is not present it won't find it. You need to add the shade-variation parameter to give it a bit of tolerance.

Link to comment
Share on other sites

pixelsearch should be in the following format: PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )

Your second example looked correct, although you chopped a bit off of the right and bottom by rounding down instead of up.

Also, if that exact pixel color is not present it won't find it. You need to add the shade-variation parameter to give it a bit of tolerance.

Thank you for your answer, but it is not my day of luck.... :P Because it does not help me a lot... Concerning your remark on the precise color:

The color is good because with this macro, it works half:

Send("{Alt Down}")
$Coord = PixelSearch( 250, 215, 750, 500, 0x99FF00 )
If Not @error Then
        MouseClick("Left", $Coord[0], $Coord[1],2,0)
        Send("{Alt Up}")
EndIf

I say half because I am obliged to advance the character of some steps manually. Then the macro runs suitably.

Thus, it is indeed about a problem of coordinates.

You say that the right and bottom coordinates seem to you too much cut? I " am nevertheless only raising Autoit Window Info's information... The instruction Pixelsearch would answer only simple estimates or some magic...

In my question, if you read it again well, I give two downloadable images onto Imageshack to the real size 1280 x 800. Would have you the kindness, you who knows well the instruction Pixelsearch to explain to me how we can find the exact coordinates of the frame which is exactly drawn there?

Thank you very much for your answer :)

I am a simple worker, but I do my best
Link to comment
Share on other sites

Thank you for your answer, but it is not my day of luck.... :P Because it does not help me a lot... Concerning your remark on the precise color:

The color is good because with this macro, it works half:

Send("{Alt Down}")
$Coord = PixelSearch( 250, 215, 750, 500, 0x99FF00 )
If Not @error Then
        MouseClick("Left", $Coord[0], $Coord[1],2,0)
        Send("{Alt Up}")
EndIf

I say half because I am obliged to advance the character of some steps manually. Then the macro runs suitably.

Thus, it is indeed about a problem of coordinates.

You say that the right and bottom coordinates seem to you too much cut? I " am nevertheless only raising Autoit Window Info's information... The instruction Pixelsearch would answer only simple estimates or some magic...

In my question, if you read it again well, I give two downloadable images onto Imageshack to the real size 1280 x 800. Would have you the kindness, you who knows well the instruction Pixelsearch to explain to me how we can find the exact coordinates of the frame which is exactly drawn there?

Thank you very much for your answer :)

Hey Shakespeare, I am but a simple American, if you could please re-word that in lamens terms I would be more than happy to help.

:P

I am way too hungover for big words this morning.

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Link to comment
Share on other sites

Hey Shakespeare, I am but a simple American, if you could please re-word that in lamens terms I would be more than happy to help.

:)

I am way too hungover for big words this morning.

You want to say "lameness" ? . Sorry but I have already said it ---> I am French, thus saddened for my poor English, but maybe I have to exuser me in every topic ?

I am a simple worker, but I do my best
Link to comment
Share on other sites

What I meant by "cut down" was that your cursor in the image was over 935,___ and you limited it to 900. This is restricting your search field farther than what you had in the image. You'd want to expand it to 950 if you wanted to have a add a little fudge-ing room. That may not be the problem... but I'm not sure what is...?

Edited by Brickoneer
Link to comment
Share on other sites

What I meant by "cut down" was that your cursor in the image was over 935,___ and you limited it to 900. This is restricting your search field farther than what you had in the image. You'd want to expand it to 950 if you wanted to have a add a little fudge-ing room. That may not be the problem... but I'm not sure what is...?

Not lameness, I'm sorry. Laemens. or lamens. It means Simple terms. For being french you speak english very well, I just don't quite understand what you want.

"advance the character of some steps manually" meaning what exactly?

"only simple estimates or some magic"

As for getting pixels, I like to use Photoshop. you know the resolution is 1200x800, so then you zoom in and outline the image, then measure from the top, and how far left.

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Link to comment
Share on other sites

what game is this xD

sorry this is off topic

BTW, is this what you mean? I'm trying to understand.

Posted Image

Have you tried running that script I posted? It allows you to change the box size of pixel search (the red).. I believe this is exactly what you are looking for, you just don't know it.

Edited by Anonymouse
children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Link to comment
Share on other sites

BTW, is this what you mean? I'm trying to understand.

Posted Image

Have you tried running that script I posted? It allows you to change the box size of pixel search (the red).. I believe this is exactly what you are looking for, you just don't know it.

I do not look for 1 only pixel, or, color of a pixel, I try to indicate to Searchpixel coordinates corresponding to the frame which I drew in the image!!!

Thus, I repeat my question: how to find exactly the coordinates of a frame to associate them with Pixelsearch?

In my case, with the tool Autoit Window Info, I find these coordinates:

Top Left ---> x = 349 y = 100

Bottom Right ---> x = 935 y = 379

So, when i lauch this macro it doesn't work :

While $Found = 0
    $Coord = PixelSearch( 349, 100, 935, 379, 0x99FF00 )
    If NOT @Error Then
        $Found = 1
    EndIf
wEnd

What's going wrong... please...

Edited by SimpleWorker
I am a simple worker, but I do my best
Link to comment
Share on other sites

Thus, I repeat my question: how to find exactly the coordinates of a frame to associate them with Pixelsearch?

In my case, with the tool Autoit Window Info, I find these coordinates:

Top Left ---> x = 349 y = 100

Bottom Right ---> x = 935 y = 379

So, when i lauch this macro it doesn't work :

While $Found = 0
    $Coord = PixelSearch( 349, 100, 935, 379, 0x99FF00 )
    If NOT @Error Then
        $Found = 1
    EndIf
wEnd

What's going wrong... please...

Try adding in a shade variance

Change: $Coord = PixelSearch( 349, 100, 935, 379, 0x99FF00 )

to: $Coord = PixelSearch( 349, 100, 935, 379, 0x99FF00, 5 )

If that doesnt work, change the 5 to 10, if it still doesnt work then I dont know whats going on. Even if you have a color for an exact pixel in a square, the color can change ever so slightly (different lighting on that pixel or something) and if you dont allow any variance, it will never find that pixel.

Basically, shade-variance is just like it sounds......it searches for that color and any color 5 shades above or below that color. For this area you dont want to go too high because there is other green around it, 5 is a good number, I have actually been working on something similar for that same area....only problem I'm having is making it fully automated as in pathing out of town......1 out of 5 runs or so it bugs and doesnt leave town, other than that its working great. :)

Edited by mwpeck
Link to comment
Share on other sites

Try adding in a shade variance

Change: $Coord = PixelSearch( 349, 100, 935, 379, 0x99FF00 )

to: $Coord = PixelSearch( 349, 100, 935, 379, 0x99FF00, 5 )

If that doesnt work, change the 5 to 10, if it still doesnt work then I dont know whats going on. Even if you have a color for an exact pixel in a square, the color can change ever so slightly (different lighting on that pixel or something) and if you dont allow any variance, it will never find that pixel.

Basically, shade-variance is just like it sounds......it searches for that color and any color 5 shades above or below that color. For this area you dont want to go too high because there is other green around it, 5 is a good number, I have actually been working on something similar for that same area....only problem I'm having is making it fully automated as in pathing out of town......1 out of 5 runs or so it bugs and doesnt leave town, other than that its working great. :)

Thank for your reply, well i've tried this :

;SciTE Version 1.76 Mar 30 2008 21:05:14

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("Guild Wars","")
If Not WinActive("Guild Wars","") Then WinActivate("Guild Wars","")
WinWaitActive("Guild Wars","")

Sleep(2000)

$Found = 0

Send("{Alt Down}")

Sleep(500)

While $Found = 0
    $Coord = PixelSearch( 349, 100, 935, 379, 0x99FF00, 10 )
    If NOT @Error Then
        $Found = 1
    EndIf
wEnd

Send("{Alt Up}")

MouseClick("Left", $Coord[0], $Coord[1],1,0)

The result is that the character is moving, but.. click on the ground, not on the NPC Scoutmaster Arne

I've also tried this (thus without shade but with others x,y coordinates for area) :

;SciTE Version 1.76 Mar 30 2008 21:05:14

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
WinWait("Guild Wars","")
If Not WinActive("Guild Wars","") Then WinActivate("Guild Wars","")
WinWaitActive("Guild Wars","")

Sleep(2000)
; Movement ---> it's the automatic run of the character
Send("h")
Sleep(1000)
; Movement ---> stop the automatic run of character
Send("h")
$Found = 0

Send("{Alt Down}")

Sleep(500)

While $Found = 0
    $Coord = PixelSearch( 250, 215, 250, 500, 0x99FF00 )
    If NOT @Error Then
        $Found = 1
    EndIf
wEnd

Send("{Alt Up}")

MouseClick("Left", $Coord[0], $Coord[1],1)

The result is that the character move, then stop, then correctly click on NPC Scoutmaster Arne

Have you please any suggest about that ?

I am a simple worker, but I do my best
Link to comment
Share on other sites

Try it with shade 5, I use that and it clicks that same NPC just fine.

$npcLoc = PixelSearch( 10, 50, 760, 700, 0x99FF00, 5, 2)
        If Not @error Then
            MouseClick("left", $npcLoc[0], $npcLoc[1], 1)
        EndIf

Thats what mine is and it works fine (that 2 on the end means only scan every other pixel, so its scanning basically half the pixels on the screen).....I could cut down the scan area but it works fine like this as a few MS is not much of an issue for this usage.

Also, a problem I see in your script:

Send("{Alt Up}")

MouseClick("Left", $Coord[0], $Coord[1],1)

You should put the MouseClick BEFORE the alt up command like so:

MouseClick("Left", $Coord[0], $Coord[1],1)

Send("{AltUp}")

Otherwise it stops holding alt, the NPC name disappears and it clicked where it first found the pixel. Its working when it moves closer to the NPC because the NPC's body is actually on the coordinates where you are clicking. Without moving, his body is not on those coordinates, so to click to NPC you have to click his name (while holding alt).

Another note, not sure if it works either way but I have always used {ALTUP} not {Alt Up}, dunno if it makes a difference or not though.

Link to comment
Share on other sites

Since you still seem to be having trouble, I will point out the answer you already have that I have been for the past few posts.

If you did not bother to even run that script and read the readme to see how it works, then I cannot help you. As for the finding pixels in a designated area, you don't give the pixels for the 4 corners.

left left coordinate of rectangle.

top top coordinate of rectangle.

right right coordinate of rectangle.

bottom bottom coordinate of rectangle.

Translation:

Left = How many pixels is this from the left of the screen?

Top, = How many pixels is this from the top of the screen?

Right = What is the width of the box + Left

Bottom = What is the height of the Box + Top

^^(Straight from the helpfile, btw)

Here is your exact answer, but not in the pixels you want, for laziness reasons:

$Top = GUICreate("Top Line", $ScanWidth, 2,$x,$y + 40,$WS_POPUP,-1,$GUI)
    GUISetBkColor(0xFF0000)
    GUISetState()
    $Left = GUICreate("Left Line", 2, $ScanHeight,$x,$y + 40,$WS_POPUP,-1,$GUI)
    GUISetBkColor(0xFF0000)
    GUISetState()
    $Right = GUICreate("Right Line", 2, $ScanHeight,$x + $ScanWidth - 2,$y + 40,$WS_POPUP,-1,$GUI)
    GUISetBkColor(0xFF0000)
    GUISetState()
    $Bottom = GUICreate("Bottom Line", $ScanWidth, 2,$x,$y + 40 + $ScanHeight,$WS_POPUP,-1,$GUI)
    GUISetBkColor(0xFF0000)
    GUISetState()

Hmmm... this looks like its the code for the red box, I just assume, I did a 2 second scan through the script.

It makes sense, but it must have a function statement with it too, because I believe you can resize it. Let me look.

Func Resize()
    HotKeySet("^a")
    Stop()
    $MoveMode = True
    While 1
        $MousePos = MouseGetPos()
        
        WinMove($Top,"", $x,$y+40,$ScanWidth,2)
        WinMove($Left,"", $x,$y+40,2,$ScanHeight)
        WinMove($Right,"", $x+ $ScanWidth - 2,$y+40,2,$ScanHeight)
        WinMove($Bottom,"", $x,$y+ 40 + $ScanHeight,$ScanWidth,2)
        
        If Not (($MousePos[0] - $x + 1) <= 40) Then
            $ScanWidth = $MousePos[0] - $x + 1
        EndIf
        If Not (($MousePos[1] - $y - 39) <= 40) Then
            $ScanHeight = $MousePos[1] - $y - 39
        EndIf
        
        If _IsPressed(01) Then
            ExitLoop
        EndIf
    WEnd
    HotKeySet("^a","Move")
EndFunc

Now, I can't really decipher these variables without knowing what they are, so lets look at what the script designates X and Y as.

Global $StartX = IniRead("MineData.ini", "Pos", "X",0)
Global $StartY = IniRead("MineData.ini", "Pos", "Y",0)
Global $x = $StartX, $y = $StartY
Global $ScanWidth = 110, $ScanHeight = 120

Have a box, have pixel search Only search within this box, and be able to resize this box as needed. All credit to JOS.

children may smile; the wise ponder- Dr. Holmes of Hardvard Medical School on an Ether BingeLove Makes The World Go Round?So does five shots of tequila. What's your point?[quote name='Valik' date='Jun 5 2008, 05:13 PM']wraithdu, 24 hours. Said I have a bad attitude, just driving the point home with a ban.[/quote]This is classic. :)
Link to comment
Share on other sites

If you did not bother to even run that script and read the readme to see how it works, then I cannot help you.

It seems that your tool does not work in 3D software such as the games

As for the finding pixels in a designated area, you don't give the pixels for the 4 corners.

It is precisely for what I try to understand, to know, how to detect the good coordinates of a frame to put back them, to use them in an instruction Pixelsearch...And I give you for it a simple example. In this example, I launched your tool so that you saw that I used it. It is me no utility because it does not send me back the informations of the frame. Furthermore, it does not work in 3D software.:

Posted Image

So can you please tell me if the informations which I find in Autoit Window Info are well the ones to put back in an instruction Pixelsearch?

Thank for your reply.

Edited by SimpleWorker
I am a simple worker, but I do my best
Link to comment
Share on other sites

Did you read what I said? Move the {Alt Up} command AFTER the mouseclick.

In GW, you only see NPC names when you mouseover or hold Alt. You are releaseing alt and trying to click on his name (which is no longer shown). You must continue to hold Alt until AFTER you click on his name.

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