Hey guys, I was wondering if anyone could help me with a script for Pokemon Planet (browser game). When the color changes from brown to blue, the bot presses the space bar and repeats it over and over again.
I already have this but it doesn't work:
^n::
loop {
PixelGetColor, color1, 995, 602, RGB
PixelGetColor, color2, 995, 602, RGB
if(color1 != #56b5b7){
Send, {space}
} else {
Sleep, 80
}
if(color2 != #a98f68){
Send, {space}
} else {
Sleep, 80
}
}
return
Numpad9::exitapp
And please excuse my English, I'm from Germany
Press Space if color changes
-
- Posts: 188
- Joined: 17 Jan 2019, 10:13
Re: Press Space if color changes
Hi,
You'll need to change the color recognition of the if command. Use if(color = "0x -6DigitcolorCode- ")
Here is an example.
You'll need to change the color recognition of the if command. Use if(color = "0x -6DigitcolorCode- ")
Here is an example.
Code: Select all
^n::
loop {
PixelGetColor, color1, -1100, 850 ; blue
PixelGetColor, color2, -1100, 850 ; white
if(color1 = "0xFFFFFF") ; if white
msgbox w
if(color2 = "0xFFE8E8") ; if blue
msgbox b
}
; mousemove, -1100, 850 ; check the right coordinates with mousemove or window spy
return
Re: Press Space if color changes
Hey,
Thank you very much for the script but I actually have no idea how and where I get the right color code. Do I need Window Spy again or is there a website
Thank you very much for the script but I actually have no idea how and where I get the right color code. Do I need Window Spy again or is there a website
-
- Posts: 188
- Joined: 17 Jan 2019, 10:13
Re: Press Space if color changes
There are lots of programs but since I'm lazy and almost never use pixelcolor I just use print screen and paste it in paint.net.
After this, use the pencil(?), don't know what it's called and click the color you want to get the color code from. Press more at the 'colors' window and then the hex code is shown. ***EDIT***
Window Spy works too
Re: Press Space if color changes
Okay now i have this:
but nothing happens. Do i need to press something to let ist start?
Code: Select all
^n::
loop {
PixelGetColor, color1, 996, 602 ; blue
PixelGetColor, color2, 996, 602 ; white
if(color1 = "0x56B5B7") ; if white
msgbox {space}
if(color2 = "0xA98F68") ; if blue
msgbox {space}
}
; mousemove, 996, 602 ; check the right coordinates with mousemove or window spy
return
-
- Posts: 188
- Joined: 17 Jan 2019, 10:13
Re: Press Space if color changes
No, you'll have to modify the code. I posted just an example since I wasn't really sure what you want to do
Please take a look at the tutorial of AHK, you are able to fix the code yourself.
https://autohotkey.com/docs/Tutorial.htm
From what I understand from the code you posted you want to send a space when the color is brown or blue?
Than the code should look something like this.
If this isn't what you want please be a bit more specific.
Do you want to press space only when the color changes from brown to blue? And also when the color changes from blue to brown?
Can the color only be blue and brown?
Please take a look at the tutorial of AHK, you are able to fix the code yourself.
https://autohotkey.com/docs/Tutorial.htm
From what I understand from the code you posted you want to send a space when the color is brown or blue?
Than the code should look something like this.
Code: Select all
^n:: ; press ctrl+n to start script
loop {
PixelGetColor, color1, 996, 602 ; blue
PixelGetColor, color2, 996, 602 ; brown
if(color1 = "blue") ; if blue (change hex code)
send {space} ; press space
if(color2 = "brown") ; if brown (change hex code)
send {space} ; press space
}
return
esc::ExitApp ; press escape to stop script
Do you want to press space only when the color changes from brown to blue? And also when the color changes from blue to brown?
Can the color only be blue and brown?
Re: Press Space if color changes
so in this game, you have to mine stones these stones are blue, if you want to start mining you have to press Spacebar and after like 1 min you are finished with mining and the stone turns brown and returns blue after 10 sec and you are able to mine again. So the just have to recognize if the stone is blue or not and if it's blue press spacebar.
- Attachments
-
- FireShot Capture 003 - - pokemon-planet.com.png (297.99 KiB) Viewed 5725 times
-
- FireShot Capture 002 - - pokemon-planet.com.png (258.72 KiB) Viewed 5726 times
-
- FireShot Capture 001 - - pokemon-planet.com.png (306.57 KiB) Viewed 5726 times
-
- Posts: 188
- Joined: 17 Jan 2019, 10:13
Re: Press Space if color changes
Ok, try changing the code to this than. It presses space when the rock is blue (mineable) and does nothing when the stone is brown.
When the stone is brown it checks every second if the stone is still brown. If it turns blue again then the script presses space again.
BTW, can't you just spam spacebar all the time even though the stone is brown? Or won't the stone reset to blue then?
Complete code will look like this.
When the stone is brown it checks every second if the stone is still brown. If it turns blue again then the script presses space again.
Code: Select all
if(color1 = "blue") ; if blue (change hex code)
send {space} ; press space
if(color2 = "brown") ; if brown (change hex code)
sleep 1000 ; wait 1 sec
Complete code will look like this.
Spoiler
Re: Press Space if color changes
Which of these coordinates should I pick?
And if you start mining and press space again it will stop mining
edit: Okay It's still doesn't work and I think that the color codes are incorrect.
And if you start mining and press space again it will stop mining
edit: Okay It's still doesn't work and I think that the color codes are incorrect.
- Attachments
-
- 2019.03.08-14.15.png (411.01 KiB) Viewed 5715 times
-
- Posts: 188
- Joined: 17 Jan 2019, 10:13
Re: Press Space if color changes
If the mining time and the waiting time are the same each time you could also skip the PixelGetColor function.
Just write a script that holds space for x sec, wait x sec and repeat.
Just write a script that holds space for x sec, wait x sec and repeat.
Re: Press Space if color changes
Remember that paint outputs in RGB and pixelgetcolor default is BGR Also you don't need to do pixelgetcolor twice, do it only once and compare the same output twice with if and else if. You need to set the proper coordmode for the coords you wrote.
If the timing is exactly like what you say "press spacebar, wait 1 minute for it to stop mining, wait 10 seconds for it to turn blue again, repeat" then you can simply do that with sleeps
or using settimer
If the timing is exactly like what you say "press spacebar, wait 1 minute for it to stop mining, wait 10 seconds for it to turn blue again, repeat" then you can simply do that with sleeps
Code: Select all
loop
{
sendinput {space}
sleep, 71000 ; 71 seconds
sendinput {space}
}
Code: Select all
settimer, mine, 71000
return
mine:
sendinput {space}
return
Re: Press Space if color changes
The mining and waiting times are randomly between 1.3 min and 5 secAviationGuy wrote: ↑08 Mar 2019, 10:34If the mining time and the waiting time are the same each time you could also skip the PixelGetColor function.
Just write a script that holds space for x sec, wait x sec and repeat.
Re: Press Space if color changes
Okay now it works with the BGR colors but it is like the bot spams the spacebar, but it should be just one timekyuuuri wrote: ↑08 Mar 2019, 11:09Remember that paint outputs in RGB and pixelgetcolor default is BGR Also you don't need to do pixelgetcolor twice, do it only once and compare the same output twice with if and else if. You need to set the proper coordmode for the coords you wrote.
If the timing is exactly like what you say "press spacebar, wait 1 minute for it to stop mining, wait 10 seconds for it to turn blue again, repeat" then you can simply do that with sleeps
or using settimerCode: Select all
loop { sendinput {space} sleep, 71000 ; 71 seconds sendinput {space} }
Code: Select all
settimer, mine, 71000 return mine: sendinput {space} return
Re: Press Space if color changes
Add more delay after it presses spacebarExtaWee wrote: ↑09 Mar 2019, 05:45Okay now it works with the BGR colors but it is like the bot spams the spacebar, but it should be just one timekyuuuri wrote: ↑08 Mar 2019, 11:09Remember that paint outputs in RGB and pixelgetcolor default is BGR Also you don't need to do pixelgetcolor twice, do it only once and compare the same output twice with if and else if. You need to set the proper coordmode for the coords you wrote.
If the timing is exactly like what you say "press spacebar, wait 1 minute for it to stop mining, wait 10 seconds for it to turn blue again, repeat" then you can simply do that with sleeps
or using settimerCode: Select all
loop { sendinput {space} sleep, 71000 ; 71 seconds sendinput {space} }
Code: Select all
settimer, mine, 71000 return mine: sendinput {space} return
Re: Press Space if color changes
Hey, sorry for necroing this thread.
I'm trying to make AHK press space when color at pixel X800, Y300 is completely white.
If it isn't, it should wait a little and check again after 20ms.
The script doesn't work, what am I doing wrong ?
Code: Select all
^n::
loop {
PixelGetColor, color1, 800, 300
if (color1 = "0xFFFFFF")
{
send {space}
}
else
{
sleep 20
}
return
}
^m::ExitApp
If it isn't, it should wait a little and check again after 20ms.
The script doesn't work, what am I doing wrong ?
Re: Press Space if color changes
Please change autohotkey.com title to autocheatforum.com @devs
Re: Press Space if color changes
I got it working. For anyone else interested:
Code: Select all
F1:: ; F1 starts script
loop {
PixelGetColor, color1, 700, 300 ; red
PixelGetColor, color2, 700, 300 ; green
if(color1 = "0x0000FF") ; if red > press space
SendInput {space}
sleep 500 ; wait 0.5s before looping, otherwise if color = red, it'll start spamming space
if(color2 = "0x00FF00") ; if green > wait 0.5s
sleep 500
}
return ; goes back to start
F2::ExitApp ; F2 ends script
Who is online
Users browsing this forum: peter_ahk, Spawnova, toddhere, USS_Sandhu and 301 guests