私と私の友人はゲームをするボットを作ったが、実行しようとすると無効な構文と表示されます。私たちはPythonでそれほど多くのことを知らないので、経験豊富な人に尋ねたいと思っていました。ここ はスクリプトです:無効な構文エラースクリプト
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <sys/time.h>
using namespace std;
int main() {
POINT p;
POINT coords[4];
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
printf("Move cursor to following tiles and press enter to select the coordinates:\n\n");
for(int i = 0; i < 4; i++) {
printf("%i. tile:", (i+1));
getchar();
GetCursorPos(&p);
coords[i] = p;
printf("- X: %d, Y: %d\n\n", p.x, p.y);
}
COLORREF currColor;
HDC dc = GetDC(NULL);
while(true) {
if(GetAsyncKeyState(VK_ESCAPE)) {
printf("\rPaused, press ENTER to continue ...");
getchar();
printf("Continue ...\n\n");
}
bool countFound = 0;
for(int i = 0; i < 4; i++) {
COLORREF color = GetPixel(dc, coords[i].x, coords[i].y);
if(color <= 3000000) {
printf("\r");
for(int j = 0; j < i; j++) {
printf("[ ] ");
}
printf("[X] ");
for(int j = 0; j < (3-i); j++) {
printf("[ ] ");
}
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
SetCursorPos(coords[i].x, coords[i].y);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
if(color > 100000) {
Sleep(50);
} else {
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
}
}
}
ReleaseDC(NULL, dc);
return 0;
}
は、事前にありがとうございます!
これはPythonではなくC++です。あなたが構文エラーを出しているのも不思議ではありません... – MattDMo
これはPythonスクリプトではなく、C++です。 Pythonではうまく動作しません。 – cdarke
*「私と私の友達はボットを作った」「あなたはしなかった。あなたはインターネットからランダムなコードをダウンロードしました。*どんな言語で書かれたのか理解していなくても、盲目的にそれを実行しようとしました。それがウイルスを広め、コンピュータを破壊する方法です。この小さなエピソードから学んでください。オンラインのすべてのコードが、それがそうであるとは言えません。 – MattDMo