EDIT: years have passed and I keep receiving private messages for this post. Please keep in mind I don't actually own the game, I just built this triggerbot for a friend and shared it here, so I can't really test it for troubleshooting. Also, why PM me instead of posting your queries here in public? Post them here so more people can potentially help you.
Here's my own version of a generic triggerbot optimized for speed. It doesn't wait for a color to become red or some specific color; instead it waits for the monitored color to change entirely. It doesn't monitor the pixel located at the exact center of the screen; instead it's slightly more down&right (to make it compatible with a wider variety of crosshair settings like the ones that have a small dot in the middle).
Works in Counter-Strike: Global Offensive.Instructions:
hold C = play script
Ins = toggle script ON/OFF
use a sniper rifle possibly I guess
Depending on your crosshair, game and window size, you may need to modify the script accordingly. This specific code was tested working on CS:GO|1920x1080|Fullscreen Windowed|Classic crosshair. You can save a screenshot and open it with Paint to find the correct coordinates for yourself.
Disabling "desktop composition" (which will turn V-Sync OFF) makes the script function better. It is known to cause issues to PixelSearch and PixelGetColor. Windows 7 and older versions can disable it easily by using a classic/basic theme (right click your Desktop > Personalize), but I'm afraid Windows 8 and 10 users can't.Script:
Code: [Select all] [Expand] [Download] (GenericTriggerbot.ahk)GeSHi © Codebox Plus
DllCall("Sleep",UInt,1) ;if the script uses too much CPU increase the Sleep time here
PixelGetColor,colorz,962,542,Slow ;fix coordinates if needed
PixelSearch,,,962,542,962,542,%colorz%,2,Fast ;same coordinates as above
if ErrorLevel = 1
Click Left Down
Click Left Up
This is pretty much how you can manually adapt this script for other games other than CS:GO. Not guaranteed to work universally since it all depends on how the game functions:
1. run the game in either "Windowed" or "Borderless Fullscreen" mode. Disable desktop composition.
2. change the coordinates (962 and 542). Help yourself with Paint (it tells you the coordinates when you move the mouse around): take a screenshot while ingame with the weapon you want, decide which pixel you want the bot to monitor (I picked a pixel slightly outside of the crosshair for CS:GO because the central one was "busy")
3. You may need to adjust the color lenience, so that the bot doesn't fire at any slight change of pixel color change. That's done by increasing the the number (2) before "Fast".