Cursor Stand ermitteln
-
warum hatte denn dein code nun immer 0/0 angezeigt? ich glaub ich red mit ner wand

-
Machine schrieb:
ich glaub ich red mit ner wand

Da bist du nicht der einzige

@Kelle: Wie wär's, wenn du unsere Antworten mal KOMPLETT liest

-
Oh sorry
keine Ahnung ich hab den Code auch schon gelöscht sonst könnt ich ihn dir geben aber ich emin was soll ich damit? 
Edit: Ich hab doch keine Ahnung von der Materie

Soweit bin ich schon:
if (kbhit()){ getch()Und jetzt?
-
also ich habe hier die komplette lösung, die du willst
aber bevor du nicht deinen ganzen code postest, denke ich, du willst, dass wir deine aufgabe lösen 
achtung test: [spoiler=test]blablabla[/spoiler]
-
Ok... hier bitteschön

#include <windows.h> #include <iostream> using namespace std; int main(int argc, char* argv[]) { //deklare POINT pt; //getposition ::GetCursorPos(&pt); //cout << "Position: " << pt.x << " / " << pt.y; //klickpos1 if (kbhit()){ getch() SetCursorPos(1020, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //klickpos2 SetCursorPos(1090, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //klickpos3 SetCursorPos(1160, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //klickpos4 SetCursorPos(1230, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //go back SetCursorPos(pt.x, pt.y); system("CLS"); getchar(); return 0; }
-
was soll das werden? bestimmt was illegales für nen spiel oder so, ne?
n bot oder so
da man bei deinem code fast augenkrebst bekommt
hier:#include <windows.h> #include <conio.h> #include <iostream> using namespace std; int main(int argc, char* argv[]) { while(1) { POINT pt; ::GetCursorPos(&pt); cout << "Position: " << pt.x << " / " << pt.y; Sleep(10); system("CLS"); if (kbhit()) { char cInp = getchar(); if( cInp == 'Y' || cInp == 'y' ) { //click position 1 SetCursorPos(1020, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //click position 2 SetCursorPos(1090, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //click position 3 SetCursorPos(1160, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //click position 4 SetCursorPos(1230, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); //go back SetCursorPos(pt.x, pt.y); //break, if program has to shut down //break; } } } return 0; }
-
Hrhr langsam nervt mich das... mein Code sieht jetzt so aus:
#include <windows.h> #include <conio.h> #include <iostream> using namespace std; int main(int argc, char* argv[]) { while(1) { POINT pt; ::GetCursorPos(&pt); //cout << "Position: " << pt.x << " / " << pt.y; system("CLS"); if (kbhit()) { char cInp = getchar(); //click position 1 if( cInp == 'Y' || cInp == 'y' ) { SetCursorPos(1020, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 2 if( cInp == 'X' || cInp == 'x' ) SetCursorPos(1090, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 3 if( cInp == 'C' || cInp == 'c' ) SetCursorPos(1160, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 4 if( cInp == 'V' || cInp == 'v' ) SetCursorPos(1230, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //go back SetCursorPos(pt.x, pt.y); //break, if program has to shut down //break; } } } return 0; }Und der Fehler liegt in der Zeile:
if( cInp == 'C' || cInp == 'c' )Wie kann das denn sein wenn das mit Y und X geht???
Edit: Hehe ja es ist ein Hotkeytool für Warcraft 3 - DotA
-
ein wenig logisch denken musst du schon

wo eine geschlossene geschweifte klammer ist, muss irgendwo auch ne geöffnete sein, oder nicht?#include <windows.h> #include <conio.h> #include <iostream> using namespace std; int main(int argc, char* argv[]) { while(1) { POINT pt; ::GetCursorPos(&pt); //cout << "Position: " << pt.x << " / " << pt.y; //system("CLS"); if (kbhit()) { char cInp = getchar(); //click position 1 if( cInp == 'Y' || cInp == 'y' ) { SetCursorPos(1020, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 2 else if( cInp == 'X' || cInp == 'x' ) { SetCursorPos(1090, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 3 else if( cInp == 'C' || cInp == 'c' ) { SetCursorPos(1160, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 4 else if( cInp == 'V' || cInp == 'v' ) { SetCursorPos(1230, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //go back SetCursorPos(pt.x, pt.y); //break, if program has to shut down //break; } } } return 0; }btw: wenn du nix schreibst, musst du auch nicht mit CLS löschen...

EDIT: als "hotkeytool" ist das aber wenig sinnvoll, da die konsole zum abfragen der tasten immer im vordergrund sein muss... da gibts bessere lösungen

-
Hmm ja das klingt einläuchtend
jetzt macht return 0; Stress und system("pause") mag er auch nicht... was tun?
-
"macht stress" ist ne nicht wirklich gute fehlerbeschreibung

-
Boah
der Kompiler möchte das nicht kompilieren weil:
expected unqualified-id before "return"
expected,' or;' before "return"
expected declaration before '}' token
-
da kommst du nicht selber drauf? steht doch da was falsch ist... wahrscheinlich fehlt das semikolon nach system("pause")...
-
Nein es ist return 0 und das Semikolon ist da...
-
dann poste deinen code, raten kann ich nicht... mein code funzt so...
-
Da oben ist er doch... Nur noch Semikola dabei:
#include <windows.h> #include <conio.h> #include <iostream> using namespace std; int main(int argc, char* argv[]) { while(1) { POINT pt; ::GetCursorPos(&pt); //cout << "Position: " << pt.x << " / " << pt.y; if (kbhit()) { char cInp = getchar(); //click position 1 if( cInp == 'Y' || cInp == 'y' ) { SetCursorPos(1020, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 2 if( cInp == 'X' || cInp == 'x' ) { SetCursorPos(1090, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 3 if( cInp == 'C' || cInp == 'c' ) { SetCursorPos(1160, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //click position 4 if( cInp == 'V' || cInp == 'v' ) { SetCursorPos(1230, 975); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } //go back SetCursorPos(pt.x, pt.y); //break, if program has to shut down //break; } } } return 0; }
-
zähl mal geöffnete geschweifte klammern und geschlossene... was fällt dir auf? eine geschlossene zuviel

und wo ist dein system("pause") ?????

-
Da steht doch return 0 hab ich doch gesagt

So jetzt macht der Kompiler keine Mucken mehr aber jetzt hab ich ein Program, das stumpf das aufschreibt was ich eintippe, bzw erst die Befehle ausführt wenn ich Enter drücke... Ich blick nichts mehr