Trigger Bot
Trigger Bot
Hi all, I'm looking for a trigger bot for a game in which your crosshair turns red when it's placed over somebody. There would ideally need to be a tolerance for the exact shade of red, because this crosshair is also slightly transparent. I'm not good at coding and any sort of trigger bots I've come across all function based on what's under your cursor, not on the colour of the cursor itself! A key to toggle the triggerbot on/off would also be very useful. Thank you in advance to anybody who is able to help.
Re: Trigger Bot
Hopefully, it’s only very slightly transparent because if it changes significantly depending on what’s behind it, it could it make it nearly impossible to tell when it turns red. Can you post some pictures?
Re: Trigger Bot
Yes, it's only slightly transparent. Here it is over dark black vs. white. Also I should note that the crosshair isn't locked in the center of your screen.
Re: Trigger Bot
They may look similar to you because they're both shades of red, but they are very different in terms of the color code. Use Window Spy to see for yourself. What they have in common, of course, is that the value of the red component is quite a bit higher than the other two. That might have made it feasible if you knew where to look, but since you have to find it first, you would have to sample a lot of pixels and do the bitwise math to calculate the difference between the values of the components. Pure AHK is going to be too slow for it to happen in real time. You would need to write an algorithm in C, compile it, then call that function from your AHK script. It's quite ambitious, and then it still might not work. If you're up to taking on that task, good luck
Re: Trigger Bot
I see, I did manage to find one which functions based on a black pixel UNDER the crosshair. It was intended to target red but it only works for black:boiler wrote: ↑13 Dec 2023, 19:49They may look similar to you because they're both shades of red, but they are very different in terms of the color code. Use Window Spy to see for yourself. What they have in common, of course, is that the value of the red component is quite a bit higher than the other two. That might have made it feasible if you knew where to look, but since you have to find it first, you would have to sample a lot of pixels and do the bitwise math to calculate the difference between the values of the components. Pure AHK is going to be too slow for it to happen in real time. You would need to write an algorithm in C, compile it, then call that function from your AHK script. It's quite ambitious, and then it still might not work. If you're up to taking on that task, good luck
Code: Select all
#Persistent
SetTimer, CheckCursorColor, 1 ; Set the timer interval to 1 millisecond
return
; Add a hotkey to stop the script when F8 is pressed
F8::
SetTimer, CheckCursorColor, Off
ExitApp
return
CheckCursorColor:
; Capture the screen around the cursor
CoordMode, Mouse, Screen
MouseGetPos, xpos, ypos
CoordMode, Pixel, Screen
PixelGetColor, color, %xpos%, %ypos%, RGB
; Define the target red color and tolerance level
TargetRedColor := "CF1A08"
Tolerance := 25 ; You can adjust this value based on your preference
; Extract individual RGB components
Red := "0x" SubStr(color, 1, 2)
Green := "0x" SubStr(color, 3, 2)
Blue := "0x" SubStr(color, 5, 2)
; Check if the color is within the tolerance range
if (Abs(Red - 255) <= Tolerance and Green <= Tolerance and Blue <= Tolerance)
{
Click ; Perform a click if the cursor is within the tolerance range of red
}
return
Last edited by gregster on 13 Dec 2023, 20:19, edited 1 time in total.
Reason: Moved topic from AHK v2 help to v1 help, based on posted v1 code.
Reason: Moved topic from AHK v2 help to v1 help, based on posted v1 code.
Re: Trigger Bot
I was under the impression that the crosshair moves, but if you’re saying it’s stationary, then it has a much greater chance of working since you only need to sample a few pixel locations.
Re: Trigger Bot
Oh, I think there was a misunderstanding. When I said it moves, I didn't mean it's a dynamic crosshair. I meant that it's not locked to the center of your screen like an FPS crosshair, you can move it freely around your screen. But it's not a dynamic crosshair - all that changes is the colour.
Re: Trigger Bot
Oh, then you’re not going to be able to just check some fixed positions. It sounds as difficult as I initially suspected unless its position is known even though it changes. The code you showed gets the color at the position of the mouse pointer. Is the crosshair just a big mouse pointer that’s located at the mouse position?
Re: Trigger Bot
Yeah it's about the same size. Like I said I'm a complete noob but how is it more difficult to determine the crosshair colour vs. the colour of the pixel that the crosshair is pointing at?boiler wrote: ↑13 Dec 2023, 21:48Oh, then you’re not going to be able to just check some fixed positions. It sounds as difficult as I initially suspected unless its position is known even though it changes. The code you showed gets the color at the position of the mouse pointer. Is the crosshair just a big mouse pointer that’s located at the mouse position?
Re: Trigger Bot
You seem to be focusing on the “big” in my question. The key part I was asking about is this: Is the position of the crosshair exactly the same as if it were a normal mouse pointer? Does it move just like a regular mouse pointer when you move the mouse? So its position is really found by using MouseGetPos? Or does moving the mouse just sort of influence how the crosshair moves, but it’s not really moving like a regular mouse pointer?
Re: Trigger Bot
It's 1:1 movement, it moves exactly like a mouse pointer.boiler wrote: ↑14 Dec 2023, 01:09You seem to be focusing on the “big” in my question. The key part I was asking about is this: Is the position of the crosshair exactly the same as if it were a normal mouse pointer? Does it move just like a regular mouse pointer when you move the mouse? So its position is really found by using MouseGetPos? Or does moving the mouse just sort of influence how the crosshair moves, but it’s not really moving like a regular mouse pointer?
Re: Trigger Bot
OK, then it has a chance of working in that scenario since you know which pixels to check.However, that brings up the prospect that only the color of the mouse pointer itself is changing, and getting the color at that position likely gets the color of whatever is behind it. You can try it and see.
-
- Posts: 1
- Joined: 30 Aug 2023, 06:13
Re: Trigger Bot
Hey! Crafting a trigger bot with color tolerance sounds interesting. While I can't assist directly with that, consider checking out forums dedicated to game modifications or coding communities. They might have resources or enthusiasts who can guide you through creating a customized trigger bot. Good luck with your project! #CodingCommunity #GameModsshockzy wrote: ↑13 Dec 2023, 04:45Hi all, I'm looking for a trigger bot for a game in which your crosshair turns red when it's placed over somebody. There would ideally need to be a tolerance for the exact shade of red, because this crosshair is also slightly transparent. I'm not good at coding and any sort of trigger bots I've come across all function based on what's under your cursor, not on the colour of the cursor itself! A key to toggle the triggerbot on/off would also be very useful. Thank you in advance to anybody who is able to help.
Re: Trigger Bot
Thank you both of you for responding!geldingminibus wrote: ↑14 Dec 2023, 05:09Hey! Crafting a trigger bot with color tolerance sounds interesting. While I can't assist directly with that, consider checking out forums dedicated to game modifications or coding communities. They might have resources or enthusiasts who can guide you through creating a customized trigger bot. Good luck with your project! #CodingCommunity #GameModsshockzy wrote: ↑13 Dec 2023, 04:45Hi all, I'm looking for a trigger bot for a game in which your crosshair turns red when it's placed over somebody. There would ideally need to be a tolerance for the exact shade of red, because this crosshair is also slightly transparent. I'm not good at coding and any sort of trigger bots I've come across all function based on what's under your cursor, not on the colour of the cursor itself! A key to toggle the triggerbot on/off would also be very useful. Thank you in advance to anybody who is able to help.
-
- Posts: 3
- Joined: 24 Jan 2024, 11:36
Re: Trigger Bot
Hey, I was wondering if you had any luck finding/creating a trigger bot script. I’m looking for a trigger bot script for this exact scenario. I would appreciate it if you could share any info you found!shockzy wrote: ↑15 Dec 2023, 00:24Thank you both of you for responding!geldingminibus wrote: ↑14 Dec 2023, 05:09Hey! Crafting a trigger bot with color tolerance sounds interesting. While I can't assist directly with that, consider checking out forums dedicated to game modifications or coding communities. They might have resources or enthusiasts who can guide you through creating a customized trigger bot. Good luck with your project! #CodingCommunity #GameModsshockzy wrote: ↑13 Dec 2023, 04:45Hi all, I'm looking for a trigger bot for a game in which your crosshair turns red when it's placed over somebody. There would ideally need to be a tolerance for the exact shade of red, because this crosshair is also slightly transparent. I'm not good at coding and any sort of trigger bots I've come across all function based on what's under your cursor, not on the colour of the cursor itself! A key to toggle the triggerbot on/off would also be very useful. Thank you in advance to anybody who is able to help.
Who is online
Users browsing this forum: kiv and 34 guests