Hello, I'm probably the newest user of AHK and I don't really have a touch with programming and kind of stuff, but I'd like to create script which will push down a key after a certain image is shown. There are multiple variations of images and which one of them will show is random, so there are multiple PixelSearch needed. I wasted quite a lot time figuring out image RGBs on one exact pixel, but it seems that I'm doing something wrong with the script.
I'll be thankful if you'll correct my mistakes.
Here is the script:
Loop
{
PixelSearch, px, py, 640, 976, 641, 977, 0x8C783B, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x6D513F, 3, Fast RGB
If ErrorLevel = 0
Send Right
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x6E6F70, 3, Fast RGB
If ErrorLevel = 0
Send Right
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x594E47, 3, Fast RGB
If ErrorLevel = 0
Send Right
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x236621, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x0F592E, 3, Fast RGB
If ErrorLevel = 0
Send Right
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x52442F, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x83566E, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x594C34, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x755126, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x655740, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x7E732C, 3, Fast RGB
If ErrorLevel = 0
Send Right
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x636367, 3, Fast RGB
If ErrorLevel = 0
Send Right
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x5F5750, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x8C7C0A, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x892F0A, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x775021, 3, Fast RGB
If ErrorLevel = 0
Send Right
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x5A5C5B, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x4F4E45, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x5B553F, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x47493E, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x302A2A, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x393126, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
else
{
PixelSearch, px, py, 640, 976, 641, 977, 0x736658, 3, Fast RGB
If ErrorLevel = 0
Send Left
}
return
Need a little(I guess) help with triggerbot script Topic is solved
Re: Need a little(I guess) help with triggerbot script
Do you need the variation of 3 in your PixelSearch?
If you don't you can just use PixelGetColor and compare the output to your current list of RGB values and perform an action from there.
If you don't you can just use PixelGetColor and compare the output to your current list of RGB values and perform an action from there.
Re: Need a little(I guess) help with triggerbot script
I don't really know, I just used a sample and then put my coordinates and colours there. If I used what you've told me "PixelGetColor", how should I use it?TygerByte wrote:Do you need the variation of 3 in your PixelSearch?
If you don't you can just use PixelGetColor and compare the output to your current list of RGB values and perform an action from there.
Re: Need a little(I guess) help with triggerbot script
Well then you need to know what the 3 is doing to your code. It's telling PixelSearch that a color variation of 3 is ok. Check the documentation again so you can get a better grasp on PixelSearch.
If you were to use PixelGetColor you would likely read https://autohotkey.com/docs/commands/PixelGetColor.htm first and use it the way I previously mention. Sounds like you are just starting out too so I'll give you some suggestions. The following code is a very basic suggestion and nothing too crazy.
Also you may want to look at how other people made their triggerbot scripts as this is a common request and there's lots of code out there already. Maybe you can get some inspiration.
Below you'll find my version of a script that looks for Red by comparing the difference of Red to Blue, but could use Green if I wanted. I choose this setup because Variation provided by PixelSearch wasn't enough so I just choose to look for a high value of Red. I could have used a number of ways to convert the PixelGetColor output from Hex to Dec, but choose NumPut and NumGet because I've never tried it before.
If you were to use PixelGetColor you would likely read https://autohotkey.com/docs/commands/PixelGetColor.htm first and use it the way I previously mention. Sounds like you are just starting out too so I'll give you some suggestions. The following code is a very basic suggestion and nothing too crazy.
Code: Select all
Loop, ; some kinda of loop or timer setup with a way to get out of the loop incase things go wrong. I suggest you make a toggle of some kind.
PixelGetColor, OutputVar, 640, 976
if ( OutputVar = My_Color_in_BGR ) {
; Do something here like click or send a key
}
Below you'll find my version of a script that looks for Red by comparing the difference of Red to Blue, but could use Green if I wanted. I choose this setup because Variation provided by PixelSearch wasn't enough so I just choose to look for a high value of Red. I could have used a number of ways to convert the PixelGetColor output from Hex to Dec, but choose NumPut and NumGet because I've never tried it before.
Code: Select all
~$*RButton::
If (Toggle) {
While (GetKeyState("RButton", "P")) {
PixelGetColor, CR, 959, 540
NumPut("0x" SubStr(CR,-5), (V:="000000"))
if ( ( NumGet(V, 0, "UChar") - NumGet(V, 2, "UChar") ) >= 70 ) {
;tooltip, % ( NumGet(V, 0, "UChar") - NumGet(V, 2, "UChar") ), 10, 10
Click
}
}
}
Return
Re: Need a little(I guess) help with triggerbot script
I've researched a bit and I've also found the way to use PixelGetColor. I made the script simpler, but I don't get why the script doesn't work, I guess it only sends SENDINPUT {LEFT} and ignores every single function above, as I've noticed whenever I minimized the game and opened up notepad it only went left.
Here is the reworked script:(As you said, I've swapped RGB into BGR)
Edit after some mins...
I've re-scripted this and tried many other variants and possibilities as I'd be so happy to see it working, but I don't get something right.
I've removed all the PixelGetColor(s) and left only one, as the COORDINATES are same for all of the 24 colours.(I guess I did it right??)
But added all of the 24 colour variants after if and else if, so I didn't randomly gave command "else sendinput {Left}", but I also added when it should sendinput {Left}, but after it just got stuck. Whenever I ran the script nothing happened literally nothing.
Here is the script:
Here is what I saw whenever opened up Autohotkey itself whenever the script was running:(I guess it got stuck on PixelGetColor.)
Here is the reworked script:(As you said, I've swapped RGB into BGR)
Code: Select all
Loop
{
Pixelgetcolor, Color1, 640, 976
Pixelgetcolor, Color2, 640, 976
Pixelgetcolor, Color3, 640, 976
Pixelgetcolor, Color4, 640, 976
Pixelgetcolor, Color5, 640, 976
Pixelgetcolor, Color6, 640, 976
Pixelgetcolor, Color7, 640, 976
if ((Color1 = 0x3F516D) or (Color2 = 0x706F6E) or (Color3 = 0x474E59) or (Color4 = 0x2E590F) or (Color5 = 0x2C737E) or (Color6 = 0x676363) or (Color7 = 0x215077))
Sendinput {RIGHT}
else
Sendinput {LEFT}
}
return
I've re-scripted this and tried many other variants and possibilities as I'd be so happy to see it working, but I don't get something right.
I've removed all the PixelGetColor(s) and left only one, as the COORDINATES are same for all of the 24 colours.(I guess I did it right??)
But added all of the 24 colour variants after if and else if, so I didn't randomly gave command "else sendinput {Left}", but I also added when it should sendinput {Left}, but after it just got stuck. Whenever I ran the script nothing happened literally nothing.
Here is the script:
Code: Select all
Loop
Pixelgetcolor, Color1, 640, 976
if ((Color1 = 0x3F516D) or (Color1 = 0x706F6E) or (Color1 = 0x474E59) or (Color1 = 0x2E590F) or (Color1 = 0x2C737E) or (Color1 = 0x676363) or (Color1 = 0x215077))
Sendinput {Right}
else if((Color1 = 0x50575F) or (Color1 = 0x0A7C8C) or (Color1 = 0x0A2F89) or (Color1 = 0x5B5C5A) or (Color1 = 0x454E4F) or (Color1 = 0x3F555B) or (Color1 = 0x3E4947) or (Color1 = 0x2A2A30) or (Color1 = 0x263139) or (Color1 = 0x586673) or (Color1 = 0x50575F) or (Color1 = 0x3B788C) or (Color1 = 0x216623) or (Color1 = 0x2F4452) or (Color1 = 0x6E5683) or (Color1 = 0x344C59) or (Color1 = 0x265175) or (Color1 = 0x405865))
Sendinput {Left}
return
Code: Select all
---- C:\Users\User\Desktop\adsad.ahk
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976
002: PixelGetColor,Color1,640,976 (0.03)
Press [F5] to refresh.
Re: Need a little(I guess) help with triggerbot script
Alright so now you probably need to debug a lil bit. I usually drop MsgBox into it or use Tooltip to debug.
I set your loop only run once and put a reload in there because you don't want an infinite loop without a way to get out. Reload also lets you reload the script quickly after changes. Change the loop amount to something else or go back to infinite loops. Also I wrapped your stuff in {} because it's important to do so and good practice.
You have so many colors you need to look for unfortunately. Is there a better spot or even a better color you can use and go back to PixelSearch with Variations? The main problem with multiple pixel searches is it's slow if speed is a concern. For example I'm only able to get about 31-33ms per search on my script and that's about the length of time for a keyboard button to be pressed and release depending on how fast you type.
Also I like the first idea of only checking if you need to hit Right and if not just hit Left. It saves a lil time and lines of code, but that requires you to find the right colors.
Some other things to take note of is if your application is Fullscreen because it won't work unless you're in Borderless Fullscreen or Windowed. You should be able to debug a lil bit with the code I provided too. I think your main problem atm is your colors. You may need to add more colors or switch to a setup that allows for variation.
I set your loop only run once and put a reload in there because you don't want an infinite loop without a way to get out. Reload also lets you reload the script quickly after changes. Change the loop amount to something else or go back to infinite loops. Also I wrapped your stuff in {} because it's important to do so and good practice.
Code: Select all
F1::
Loop, 1
{
Pixelgetcolor, Color1, 640, 976
if ((Color1 = 0x3F516D) or (Color1 = 0x706F6E) or (Color1 = 0x474E59) or (Color1 = 0x2E590F) or (Color1 = 0x2C737E) or (Color1 = 0x676363) or (Color1 = 0x215077))
{
Send, {Right}
MsgBox, I Hit Right and my Color was %Color1%
}
else if ((Color1 = 0x50575F) or (Color1 = 0x0A7C8C) or (Color1 = 0x0A2F89) or (Color1 = 0x5B5C5A) or (Color1 = 0x454E4F) or (Color1 = 0x3F555B) or (Color1 = 0x3E4947) or (Color1 = 0x2A2A30) or (Color1 = 0x263139) or (Color1 = 0x586673) or (Color1 = 0x50575F) or (Color1 = 0x3B788C) or (Color1 = 0x216623) or (Color1 = 0x2F4452) or (Color1 = 0x6E5683) or (Color1 = 0x344C59) or (Color1 = 0x265175) or (Color1 = 0x405865))
{
Send, {Left}
MsgBox, I Hit Left and my Color was %Color1%
}
MsgBox, My Color was %Color1%
}
return
F5::Reload
Also I like the first idea of only checking if you need to hit Right and if not just hit Left. It saves a lil time and lines of code, but that requires you to find the right colors.
Some other things to take note of is if your application is Fullscreen because it won't work unless you're in Borderless Fullscreen or Windowed. You should be able to debug a lil bit with the code I provided too. I think your main problem atm is your colors. You may need to add more colors or switch to a setup that allows for variation.
Re: Need a little(I guess) help with triggerbot script
I copied your code and ran it. I got upset that ALL the colours were incorrect, it wasn't my fault, Window Spy was saying that on that coordinate was that colour, but then whenever I ran your script then I understood that "MsgBox, My Colour was %Color1%" was only giving true colours of the coordinates.
Then I put that BGR code in the script which %Color1% gave me, it did output "I hit left and my colour was %Color1%" and "My colour was %color1%", but it didn't really press the key, I mean I've to manually press the left arrow(OR key "A", it does same) to go to next random image. I guess we found out that colours were incorrect(I don't know why did Window Spy give wrong colours tbh), but now let's make sure it really presses the A or D keys (Left or Right).
Then I put that BGR code in the script which %Color1% gave me, it did output "I hit left and my colour was %Color1%" and "My colour was %color1%", but it didn't really press the key, I mean I've to manually press the left arrow(OR key "A", it does same) to go to next random image. I guess we found out that colours were incorrect(I don't know why did Window Spy give wrong colours tbh), but now let's make sure it really presses the A or D keys (Left or Right).
I don't really need speed, I'm just making AFK bot, so I can just sit and watch TV and the script kept pressing the right keys upon showing a random one from 24 images. If that's a matter and we can simplify script by using another command but with high rendering time, I agree.You have so many colors you need to look for unfortunately. Is there a better spot or even a better color you can use and go back to PixelSearch with Variations? The main problem with multiple pixel searches is it's slow if speed is a concern. For example I'm only able to get about 31-33ms per search on my script and that's about the length of time for a keyboard button to be pressed and release depending on how fast you type.
The game is running in Boardless Window mode since I knew that I couldn't start making an on-pixel script for a Fullscreen application.Some other things to take note of is if your application is Fullscreen because it won't work unless you're in Borderless Fullscreen or Windowed. You should be able to debug a lil bit with the code I provided too. I think your main problem atm is your colors. You may need to add more colors or switch to a setup that allows for variation.
Re: Need a little(I guess) help with triggerbot script
Yea for getting the right pixel color and coordinates I usually resort to a hotkey with a msgbox or just a printscreen script that outputs into a PNG file where I can grab them later on paint or something. As for why your key doesn't work you can try some of the suggestions on our tutorial forum. https://autohotkey.com/boards/viewtopic.php?f=7&t=11084 Basically you might need to delay the keypress or try the other send modes.
Another bit of advice is if the color is representative of something you can put it in variable so you know and can keep track of it later. Maybe even change if needed. ofc you would use something besides ImageOne for the name tho.
Another bit of advice is if the color is representative of something you can put it in variable so you know and can keep track of it later. Maybe even change if needed. ofc you would use something besides ImageOne for the name tho.
Code: Select all
ImageOne := 0x3F516D
ImageTwo := 0x706F6E
xpos := 640
ypos := 976
F1
PixelGetColor, Color1, xpos, ypos
if (Color1 = ImageOne) {
Click
}
Return
Re: Need a little(I guess) help with triggerbot script
Alright, I'll change the script tomorrow with the colours being variables and maybe even try to fix a key pressing bug. Btw is there any way to put the colour detection between colour range? Like "green" and script automatically detecting if the pixel is somewhere between green, it'll send key.
Ight will update reply tomorrow, I wish everything will go as good as planned.
Ight will update reply tomorrow, I wish everything will go as good as planned.
-
- Posts: 69
- Joined: 28 Dec 2017, 02:53
Re: Need a little(I guess) help with triggerbot script
cant you just search pixel color in the center and if not send click, or you want to just wave around and if you ever mouse over the enemy it shoots
Re: Need a little(I guess) help with triggerbot script Topic is solved
GreatGazoo wrote:cant you just search pixel color in the center and if not send click, or you want to just wave around and if you ever mouse over the enemy it shoots
You make it sound so easy. OP's problem is finding the best way to determine when to hit Right or Left and I know nothing about their game lol.
Re: Need a little(I guess) help with triggerbot script
So, I changed the script, everything works, but it doesn't press the key. I mean AHK presses the key, but nothing happens in-game, unless I manually press the key.
I tried running the compiled script as administrator, didn't work either. I tried using sleep 1000, so it'd press the key for at least 1s, but didn't work. At last I thought it was kind of the game keybinding problem and I changed in-game A and D to N and M, also changed keys in script, but same, AHK was pressing the key, but game didn't really recognize it. I'm in a deep problem I guess?
Here's a script:(If you were curious in what I needed script you may actually guess from the code now)
Here's what does AHK show whenever running the script:
P.S: I accidentaly pressed the "solved" button...
I tried running the compiled script as administrator, didn't work either. I tried using sleep 1000, so it'd press the key for at least 1s, but didn't work. At last I thought it was kind of the game keybinding problem and I changed in-game A and D to N and M, also changed keys in script, but same, AHK was pressing the key, but game didn't really recognize it. I'm in a deep problem I guess?
Here's a script:(If you were curious in what I needed script you may actually guess from the code now)
Code: Select all
Loop
{
Salmon1 := 0x8A97A7
Salmon2 := 0x758687
Salmon3 := 0x6894A0
Salmon4 := 0x99B4CE
Salmon5 := 0x49728E
Salmon6 := 0x364C5D
Salmon7 := 0x6B99B2
Salmon8 := 0x667B78
Salmon9 := 0x53819B
Salmon10 := 0x40404A
Salmon11 := 0xA0A19E
Fish1 := 0xF16941
Fish2 := 0x2EB432
Fish3 := 0x00E0FF
Fish4 := 0x0049F9
Fish5 := 0xC495EE
Fish6 := 0x378BD2
Fish7 := 0x61D8FF
Papers := 0xC8C7C5
Box := 0x2E8AD6
MetalBottle := 0x78859B
PlasticBottle := 0xB7AEAE
Tube := 0x688CC3
GreenGarbage := 0x479B0B
Battery := 0x44CEE4
xpos := 640
ypos := 976
Pixelgetcolor, color1, xpos, ypos
if ((color1 = Salmon1) or (color1 = Salmon2) or (color1 = Salmon3) or (color1 = Salmon4) or (color1 = Salmon5) or (color1 = Salmon6) or (color1 = Salmon7) or (color1 = Salmon8) or (color1 = Salmon9) or (color1 = Salmon10) or (color1 = Salmon11) or (color1 = Fish1) or (color1 = Fish2) or (color1 = Fish3) or (color1 = Fish4) or (color1 = Fish5) or (color1 = Fish6) or (color1 = Fish7))
{
Send, {n}
}
else if ((color1 = Papers) or (color1 = Box) or (color1 = MetalBottle) or (color1 = PlasticBottle) or (color1 = Tube) or (color1 = GreenGarbage) or (color1 = Battery))
{
send, {m}
}
}
return
F2::Pause
Code: Select all
003: Salmon1 := 0x8A97A7
004: Salmon2 := 0x758687
005: Salmon3 := 0x6894A0
006: Salmon4 := 0x99B4CE
007: Salmon5 := 0x49728E
008: Salmon6 := 0x364C5D
009: Salmon7 := 0x6B99B2
010: Salmon8 := 0x667B78
011: Salmon9 := 0x53819B
012: Salmon10 := 0x40404A
013: Salmon11 := 0xA0A19E
014: Fish1 := 0xF16941
015: Fish2 := 0x2EB432
016: Fish3 := 0x00E0FF
017: Fish4 := 0x0049F9
018: Fish5 := 0xC495EE
019: Fish6 := 0x378BD2
020: Fish7 := 0x61D8FF
021: Papers := 0xC8C7C5
022: Box := 0x2E8AD6
023: MetalBottle := 0x78859B
024: PlasticBottle := 0xB7AEAE
025: Tube := 0x688CC3
026: GreenGarbage := 0x479B0B
027: Battery := 0x44CEE4
028: xpos := 640
029: ypos := 976
031: PixelGetColor,color1,xpos,ypos
032: if ((color1 = Salmon1) || (color1 = Salmon2) || (color1 = Salmon3) || (color1 = Salmon4) || (color1 = Salmon5) || (color1 = Salmon6) || (color1 = Salmon7) || (color1 = Salmon8) || (color1 = Sa
036: if ((color1 = Papers) || (color1 = Box) || (color1 = MetalBottle) || (color1 = PlasticBottle) || (color1 = Tube) || (color1 = GreenGarbage) || (color1 = Battery))
038: Send,{m} (0.02)
039: }
040: }
003: Salmon1 := 0x8A97A7
004: Salmon2 := 0x758687
005: Salmon3 := 0x6894A0
006: Salmon4 := 0x99B4CE
007: Salmon5 := 0x49728E
008: Salmon6 := 0x364C5D
009: Salmon7 := 0x6B99B2
010: Salmon8 := 0x667B78
011: Salmon9 := 0x53819B
012: Salmon10 := 0x40404A
013: Salmon11 := 0xA0A19E
014: Fish1 := 0xF16941
015: Fish2 := 0x2EB432
016: Fish3 := 0x00E0FF
017: Fish4 := 0x0049F9
018: Fish5 := 0xC495EE
019: Fish6 := 0x378BD2
020: Fish7 := 0x61D8FF
021: Papers := 0xC8C7C5
022: Box := 0x2E8AD6
023: MetalBottle := 0x78859B
024: PlasticBottle := 0xB7AEAE
025: Tube := 0x688CC3
026: GreenGarbage := 0x479B0B
027: Battery := 0x44CEE4
028: xpos := 640
029: ypos := 976
031: PixelGetColor,color1,xpos,ypos (0.02)
043: Pause (2.38)
Re: Need a little(I guess) help with triggerbot script
You probably misread the tutorial when it meant delaying the press.
This example is taken from the tutorial post https://autohotkey.com/boards/viewtopic.php?f=7&t=11084
also you don't have to keep the variables inside the loop
This example is taken from the tutorial post https://autohotkey.com/boards/viewtopic.php?f=7&t=11084
Code: Select all
Send, {a down}
Sleep 20
Send, {a up}
Code: Select all
Salmon1 := 0x8A97A7
Salmon2 := 0x758687
Salmon3 := 0x6894A0
Salmon4 := 0x99B4CE
Salmon5 := 0x49728E
Salmon6 := 0x364C5D
Salmon7 := 0x6B99B2
Salmon8 := 0x667B78
Salmon9 := 0x53819B
Salmon10 := 0x40404A
Salmon11 := 0xA0A19E
Fish1 := 0xF16941
Fish2 := 0x2EB432
Fish3 := 0x00E0FF
Fish4 := 0x0049F9
Fish5 := 0xC495EE
Fish6 := 0x378BD2
Fish7 := 0x61D8FF
Papers := 0xC8C7C5
Box := 0x2E8AD6
MetalBottle := 0x78859B
PlasticBottle := 0xB7AEAE
Tube := 0x688CC3
GreenGarbage := 0x479B0B
Battery := 0x44CEE4
xpos := 640
ypos := 976
Loop
{
Pixelgetcolor, color1, xpos, ypos
if ((color1 = Salmon1) or (color1 = Salmon2) or (color1 = Salmon3) or (color1 = Salmon4) or (color1 = Salmon5) or (color1 = Salmon6) or (color1 = Salmon7) or (color1 = Salmon8) or (color1 = Salmon9) or (color1 = Salmon10) or (color1 = Salmon11) or (color1 = Fish1) or (color1 = Fish2) or (color1 = Fish3) or (color1 = Fish4) or (color1 = Fish5) or (color1 = Fish6) or (color1 = Fish7))
{
Send, {n Down}
Sleep, 30
Send, {n Up}
}
else if ((color1 = Papers) or (color1 = Box) or (color1 = MetalBottle) or (color1 = PlasticBottle) or (color1 = Tube) or (color1 = GreenGarbage) or (color1 = Battery))
{
Send, {m Down}
Sleep, 30
Send, {m Up}
}
}
return
F2::Pause
Re: Need a little(I guess) help with triggerbot script
I actually copy-pasted your code, I just changed the keybinds back to Left and Right(Also tried A and D), but it doesn't work. I don't have an idea why shouldn't it...
Here are the AHK lines:(Many more same lines over and over, I noticed that it doesn't send key anymore)
Also, an interesting graph I've found in AHK>View>Key history and script info. Check this out:
As the info above tells me, type "i"=Ignored because it was generated by an AHK script. What does that mean and how can we make it work? I'm also thinking of this :
"Some games do not allow their keybinds to be 'hijacked'.
-Explanation: Many games, especially DirectX driven, use driver level keyboard interaction and cannot be
changed via AHK. You need to choose keybindings that the game is NOT using, some people have had
success by changing the in-game keybinds so that those keys are 'free' for AHK to use."
Here are the AHK lines:(Many more same lines over and over, I noticed that it doesn't send key anymore)
Code: Select all
038: if ((color1 = Papers) || (color1 = Box) || (color1 = MetalBottle) || (color1 = PlasticBottle) || (color1 = Tube) || (color1 = GreenGarbage) || (color1 = Battery))
044: }
031: PixelGetColor,color1,xpos,ypos
032: if ((color1 = Salmon1) || (color1 = Salmon2) || (color1 = Salmon3) || (color1 = Salmon4) || (color1 = Salmon5) || (color1 = Salmon6) || (color1 = Salmon7) || (color1 = Salmon8) || (color1 = Sa
038: if ((color1 = Papers) || (color1 = Box) || (color1 = MetalBottle) || (color1 = PlasticBottle) || (color1 = Tube) || (color1 = GreenGarbage) || (color1 = Battery))
044: }
031: PixelGetColor,color1,xpos,ypos (0.03)
032: if ((color1 = Salmon1) || (color1 = Salmon2) || (color1 = Salmon3) || (color1 = Salmon4) || (color1 = Salmon5) || (color1 = Salmon6) || (color1 = Salmon7) || (color1 = Salmon8) || (color1 = Sa
038: if ((color1 = Papers) || (color1 = Box) || (color1 = MetalBottle) || (color1 = PlasticBottle) || (color1 = Tube) || (color1 = GreenGarbage) || (color1 = Battery))
044: }
Code: Select all
VK SC Type Up/Dn Elapsed Key
25 14B i d 0.00 Left
25 14B i u 0.05 Left
25 14B i d 0.01 Left
25 14B i u 0.05 Left
25 14B i d 0.05 Left
25 14B i u 0.05 Left
25 14B i d 0.02 Left
25 14B i u 0.05 Left
25 14B i d 0.02 Left
25 14B i u 0.05 Left
25 14B i d 0.02 Left
25 14B i u 0.05 Left
25 14B i d 0.05 Left
25 14B i u 0.05 Left
25 14B i d 0.02 Left
25 14B i u 0.05 Left
25 14B i d 0.01 Left
25 14B i u 0.05 Left
25 14B i d 0.02 Left
25 14B i u 0.05 Left
25 14B i d 0.01 Left
25 14B i u 0.05 Left
25 14B i d 0.05 Left
25 14B i u 0.05 Left
25 14B i d 0.05 Left
25 14B i u 0.05 Left
25 14B i d 0.05 Left
25 14B i u 0.05 Left
25 14B i d 0.05 Left
25 14B i u 0.05 Left
25 14B i d 0.05 Left
25 14B i u 0.05 Left
25 14B i d 0.05 Left
25 14B i u 0.05 Left
25 14B i d 0.01 Left
"Some games do not allow their keybinds to be 'hijacked'.
-Explanation: Many games, especially DirectX driven, use driver level keyboard interaction and cannot be
changed via AHK. You need to choose keybindings that the game is NOT using, some people have had
success by changing the in-game keybinds so that those keys are 'free' for AHK to use."
Re: Need a little(I guess) help with triggerbot script
Umm you can try running this script https://autohotkey.com/board/topic/9565 ... -tool-v41/
I goes through a bunch of ways to send keys. I found it a little hard to use, but eventually got it to work. GL
I goes through a bunch of ways to send keys. I found it a little hard to use, but eventually got it to work. GL
Re: Need a little(I guess) help with triggerbot script
Happy new year!
So I used "send and click" tool, but it didn't gave me results. I put A as a test key and tested all the send commands to see if any of them would work, but it didn't give me any result. What should we do now?
I guess its game anticheat which keeps blocking "programmed keys" and only allows physical keyboard keys. How can I bypass that? Any way to let the system get those "programmed keys" as a physical pressed keys, so anticheat won't be blocking all these send commands?
So I used "send and click" tool, but it didn't gave me results. I put A as a test key and tested all the send commands to see if any of them would work, but it didn't give me any result. What should we do now?
I guess its game anticheat which keeps blocking "programmed keys" and only allows physical keyboard keys. How can I bypass that? Any way to let the system get those "programmed keys" as a physical pressed keys, so anticheat won't be blocking all these send commands?
-
- Posts: 69
- Joined: 28 Dec 2017, 02:53
Re: Need a little(I guess) help with triggerbot script
might be a dumb question, did you try SendPlay ? probably so.... yeah if you tried them all
Re: Need a little(I guess) help with triggerbot script
Send And Click tool tested all the possible send commands, but it didn't give results in-game. Can we bypass anticheat somehow and send those programmed keys as a physical keyboard presses?
Re: Need a little(I guess) help with triggerbot script
Yes you're not the only one whose has had such problems. I haven't encountered it, but a long time a go on another forum there was such talks of such. https://autohotkey.com/board/topic/9324 ... /?p=591730 and the main keyword here is low level driver. It's a long read if you want. I still haven't taken the time, but glanced at it shortly. You could also try Interception, but I'm not sure. It's another term I see often when searching for such things on the forum. GL
Re: Need a little(I guess) help with triggerbot script
I don't really know what to check or copy from there, or what to use where. I guess I can't make it myself then?
Who is online
Users browsing this forum: No registered users and 102 guests