Jump to content

Help with Color check, not working properly?


Collin
 Share

Recommended Posts

Hello,, I am in a game and I developed a program to do a certain task within this game

Here is the code

CODE

Global $Paused

HotKeySet("{PAUSE}", "TogglePause")

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

Opt("MouseClickDragDelay", 100)

;StarWarsGalaxies Fishing Macro With Auto Filet

;Sleep("5000")

Sleep("5000")

;Created a /forage macro and mapped it to N

$i = 0

;$var1 = "5612966" ;Color of pixel in fishing box while open, refer to var11/12 (same spot) (YELLOW dot in picture)

$var9 = 177 ;Imput X Ofirst open slot (where fish goes in)(BIG RED DOT IN PICTURE)

$var10 = 504 ;Imput Y first open slot (where fish goes in)

$var3 = 46 ;Imput X First bag (BIG PURPLE DOT IN PICTURE)

$var4 = 504 ;Imput Y First Bag

$var7 = 115 ;Imput X Second bag (BIG BLUE DOT IN PICTURE)

$var8 = 505 ;Imput Y Second bag

$var5 = 400 ;Imput X Option 1 Fishing Box (BIG GREEN DOT IN PICTURE)

$var6 = 200 ;Imput Y Option 1 Fishing Box

$var11 = 472 ;Imput X Blue space on top of fishing Box (BIG YELLOW DOT IN PICTURE)

$var12 = 40 ;Imput Y Blue space on top of fishing box

$var14 = 40 ;X coord of Blank box

$var15 = 560 ; Y coord of blank box

$var16 = 60 ;X right coord of blank box

$var17 = 580 ;Y Bottom Coord of blank box

$var18 = 183

$var19 = 434 ;3rd bag

$i = 0

Do

If WinActive( "Star Wars Galaxies", "" ) Then

Opt("ColorMode", 0)

Opt("PixelCoordMode", 2)

sleep("200")

send("{G}"); starts fishing (/fishing macro mapped to G key)

sleep("1000")

$checksum = PixelChecksum($var14, $var15, $var16, $var17)

Sleep ("1000")

MouseClick ( "right" , $var9, $var10, 1 ) ;Auto Filets Fish

Sleep ("1000")

send("3")

Sleep("2500")

If $checksum = PixelChecksum($var14, $var15, $var16, $var17) Then

;MouseClickDrag ( "left" , $var9, $var10, $var18, $var19, 1) ;Drag fish to backpack

Sleep("1000")

MouseClickDrag ( "left" , $var9, $var10, $var3, $var4, 1) ;Drag fish to backpack

Sleep("1000")

MouseClickDrag ( "left" , $var9, $var10, $var7, $var8, 1) ;Drag fish to backpack

Sleep("5000")

Else

MouseClick ( "right" , $var9, $var10, 1 ) ;Auto Delete fish if it fillet'd, meaning it a 0 fish

Sleep ("1500")

send("2")

Sleep ("1500")

;MouseClickDrag ( "left" , $var9, $var10, $var18, $var19, 1) ;Drag fish to backpack

Sleep("1000")

MouseClickDrag ( "left" , $var9, $var10, $var3, $var4, 1) ;Drag fish to backpack

Sleep("1000")

MouseClickDrag ( "left" , $var9, $var10, $var7, $var8, 1) ;Drag fish to backpack

Sleep("3000")

Endif

$var1 = PixelGetColor( $var11 , $var12 )

For $x = 1 to 50

MouseClick("left",$var5, $var6,3); selects the 1st option in fishing window

sleep("200")

sleep("7500")

$var13 = PixelGetColor( $var11 , $var12 ) ;0x55A5A6 Decimal 5612966 Checks if Fishing window open

If $var13 = ($var1) Then

sleep("100")

Else

For $z = 1 to 25

$var14 = PixelGetColor( $var11 , $var12 ) ;0x55A5A6 Decimal 5612966 checks fishign window open

If $var14 = ($var1) Then ;while waiting for fish/snag it checks if fishing window re opens

Sleep("250") ;if fishing window re opens this check every 2 seconds, resets if it does

$z = 20

$x = 1

Else

Sleep("2000") ;if fishing window isn't open, it waits max 40 seconds for it to catch fish, then restarts macro

If $z = 1 Then

Sleep("3000")

Send("{w down}")

Sleep("1000")

Send("{w up}")

Endif

$x = 50

EndIf

Next

Send("{s down}")

Sleep("1000")

Send("{s up}")

Sleep("1000")

Endif

Next

EndIf

Until $i = 1

Func TogglePause()

$Paused = NOT $Paused

While $Paused

sleep(100)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Func Terminate()

Exit 0

EndFunc

Now this was developed from a working version I created without the color check

If you will notice I put in $checksum = PixelChecksum($var14, $var15, $var16, $var17)

and then If $checksum = PixelChecksum($var14, $var15, $var16, $var17) Then shortly there after it

I have tested it and it doesnt' seem to make one lick of difference, the checksum doesn't work

I have triekd getpixelcolor, and same if command, I've tried the pixel search command.. I don't know what to do next

The circumstances are in the picture below.. its an older picture but gives you an idea of what I'm working in

the "check color" would be on the standard blue area of the box on the left

Thus, When it runs,, It does its checksum to get a baseline,, does some other stuff..and if its changed it should do one set of commands..but if it hasn't changed it does another

*** Now the picture shows one snippet of the screen,, I'm running the game in a windowed mode so I can use Auto it to help automate,

The RED Dot represents the type of area I'm trying to run a color check on,

to let me know if something shows up

Any thoughts on why every single color check I try fails? either doesn't work completely, or the numbers change drastically ***AFTER*** It runs through one cycle..

Thoughts would help

thanks

COllin

post-29018-1194844412_thumb.jpg

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