Detect Color And click or reset Run

Ask gaming related questions
amneet
Posts: 1
Joined: 11 May 2024, 23:33

Detect Color And click or reset Run

Post by amneet » 11 May 2024, 23:39

Hello,

I am trying to write a script for a game (Balatro, if anyone is familiar) to detect a color, if the color is seen, click a box. If there is a blue card seen, exit the code, but if neither of the two colors are detected reset the run.

I used chatgpt for alot of this code, but I cannot get ErrorLevel or the color detection to work and I was wondering if someone could help me out.

The escape and other keystrokes seem to work. The main issue is color detection and I get a popup interrupting the loop every time about ErrorLevel not being assigned a value.

[ChatGPT-generated code removed by moderator.]
User avatar
boiler
Posts: 17210
Joined: 21 Dec 2014, 02:44

Re: Detect Color And click or reset Run

Post by boiler » 12 May 2024, 04:03

Your main problem is using ChatGPT. Asking for help with code that it generates is against forum rules, which is why I deleted it. This is a good example of why. It makes very fundamental mistakes, wasting your time and the forum helpers’ time undoing its mess. Please don’t ask for help with code it created again.

AHK v2 doesn’t even use ErrorLevel, which would be clear if you used the documentation instead of ChatGPT. You just use the return value of the function:

Code: Select all

if PixelSearch(…)
{
	; pixel was found
}

You also don’t use % signs around variables in v2 because v2 uses expressions throughout.
Post Reply

Return to “Gaming”