Sign in to follow this  
Followers 0
Vindicator209

Pixel Color

8 posts in this topic

#1 ·  Posted (edited)

Im still sorta new at this, so please dont get frustrated...

i need to figure out how to find pixel codes, as in:

(PixelGetColor(254,87) = 14402189)

i have actually no idea what that means but i need the red part text to make it find the color red?

because i need it to search repeatedly until the color red shows up somewhere on the screen, and if it does find it, i want it to have an "If" function so that if red comes up, it does something, in my case, click a link

EDIT:also, can anyone tell me how to loop a certain part of the script?

-----------------------

Thanks Much in advanced

-------

-dont have to read this part-

To give a smaller idea, theres a game called kingdom of lothing, andi have an auto battler that clicks the main frame and press "tab" then "enter" to attack the monster,but between each repetition, i want it to search for red ( which is what color your HP turns to when you are dead) and if there is red, click the "campground" button at the top and send "rest"

---------

p.s.s. (3rd method)

There are 4 FRAMES in this web page based game, the top menue, character sheet, chat window, and main window, i am trying to get autoit to target the frame named "main" and send a url to it, in my case, it would be "http://www6.kingdomofloathing.com/campgroound.php?action=rest"

IF ANYONE CAN HELP ME WITH ANY OF THESE, i would be most thankful, for i usually only turn to the forums when im stuck for more than a week

EDIT: Script

$Lag=inputbox("The Kingdom Loathing Farmer","How Long of a wait? (How much time between each attack? Default: 5000, 1000= 1 second)")
$answer = MsgBox(4, "License", "Do you wish to continue?")
If $answer = 7 Then
    MsgBox(4096, "Ok", "Action Cancled")
    Exit
EndIf
  ;Starting here is where i would likly want it to loop
MsgBox(48, "Waiting", "5 seconds to start, start timer by clicking OK")
sleep(5000)
    MouseMove(521,362,0)
    MouseClick("left",521,362,2)
send("{tab}")
send("{enter}")
sleep($Lag)
 ;and loop ending here after like 80 repititions ( usually copy and paste like 80 times to acuire this)

MsgBox(48,"DONE","I'm done")
Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



Im still sorta new at this, so please dont get frustrated...

i need to figure out how to find pixel codes, as in:

(PixelGetColor(254,87) = 14402189)

i have actually no idea what that means but i need the red part text to make it find the color red?

because i need it to search repeatedly until the color red shows up somewhere on the screen, and if it does find it, i want it to have an "If" function so that if red comes up, it does something, in my case, click a link

OK... first try pixelsearch instead of pixelgetcolor, it does exactly what you want

next look at this website

Online Beta Helpfile

Share this post


Link to post
Share on other sites

.........woa

ok thanks, but i still dont know how to get co ordinates , or the decimal for either


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

get that color

its in my sig below

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

.........woa

ok thanks, but i still dont know how to get co ordinates , or the decimal for either

If you are looking for a specific location of something that pops up in game, use the "Autoit Window Info" tool to get the location/pixelcolor, or if that doesn't work, do a screenshot, then use a graphics editing tool (photoshop/gimp) to find the location of the pixel you are attempting to work with.

Share this post


Link to post
Share on other sites

$RedLink = PixelSearch(top, left, right, bottom, 0x6 digit hex color, how many different shades of red, how many steps to take (1 = every pixel in the box))

If Not @error Then

MouseClick( "left", $RedLink[0], $RedLink[1], 1, 0)

EndIf

Is that it?

Share this post


Link to post
Share on other sites

ok thanks! one last question though, how do i fix this?:

While $attack < 5
    $attack = send("{tab}") and send("{enter}")
Wend

Error: Variable used without being declared

again, thank you everyone


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Global $attack=0

While $attack < 5
    $attack = send("{tab}") and send("{enter}")
Wend

That should do it...

before actually using a variable, you have to let autoit know how you want to use it.

look at:

Global

Local

Dim

In the helpfile

Edited by Paulie

Share this post


Link to post
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
Sign in to follow this  
Followers 0