| View previous topic :: View next topic |
| Author |
Message |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Wed Jun 18, 2008 5:25 pm Post subject: [C++]storing information |
|
|
I'm making a program, where when you press f3 it gets the cursor pos and sets it in a thing so its usable, something like
GetAsyncKeyState(VK_F5){
setData.fde To getCursorPos()
}
GetAsyncKeyState(VK_F6){
setCursorPos(getData.fde)
}
_________________
| qwerty147 wrote: |
| ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jun 18, 2008 6:16 pm Post subject: |
|
|
Wow, do you need to be spoonfed everything. At least try...
| Code: |
bool bQuit = TRUE;
POINT point;
string points;
do {
if(GetAsyncKeyState(VK_F3)) {
if(GetCursorPos(&point)) {
sprintf_s(points, 255, "Mouse Coordinates: %d, %d", point.x,
point.y);
}
}
if(GetAsyncKeyState(VK_F5)) {
if(!SetCursorPos(point.x, point.y)) {
bQuit = FALSE;
}
}
if(GetAsyncKeyState(VK_F4)) {
bQuit = FALSE;
}
} while(bQuit == TRUE);
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
Last edited by oib111 on Wed Jun 18, 2008 6:18 pm; edited 1 time in total |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Wed Jun 18, 2008 6:19 pm Post subject: |
|
|
| oib111 wrote: | Wow, do you need to be spoonfed everything. At least try...
| Code: |
bool bQuit = TRUE;
POINT point;
string points;
do {
if(GetAsyncKeyState(VK_F3)) {
if(GetCursorPos(&point)) {
sprintf_s(points, 255, "Mouse Coordinates: %d, %d", point.x,
point.y);
}
if(GetAsyncKeyState(VK_F5))
if(!SetCursorPos(point.x, point.y)) {
bQuit = FALSE;
}
}
if(GetAsyncKeyState(VK_F4)) {
bQuit = FALSE;
}
} while(bQuit == TRUE);
|
|
If your going to feed me like a baby, explain the code so i'll learn.[/b]
_________________
| qwerty147 wrote: |
| ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jun 18, 2008 6:19 pm Post subject: |
|
|
Huh? What are you talking about?
@ElectroFusion
The only reason I'm feeding you like a baby is because that's what you're asking. If you try and get errors it's different. Anyway, I thought the whole idea as saving it as a text file was inefficient seeing as you have call more functions when it would be exactly the same as using the x and y positions stored in the POINT structure. As for explaining the code go to the links slovach posted. But here's a rundown:
| Code: |
bool bQuit = TRUE; //declare a variable to be used as our condition
POINT point; //make a point structure to hold the x and y coords
string points; //make a string to hold the coords in a readable format
do { //start a do while loop
if(GetAsyncKeyState(VK_F3)) { //if F3 is pressed
if(GetCursorPos(&point)) { //get the mouse coords and store them in our POINT structure, point
sprintf_s(points, 255, "Mouse Coordinates: %d, %d", point.x,
point.y); //convert the x and y integers to string format and store in our points string
}
}
if(GetAsyncKeyState(VK_F5)) { //if F5 is pressed
if(!SetCursorPos(point.x, point.y)) { check to see if SetCursorPos API failed
bQuit = FALSE; //if so make our condition FALSE, making our loop stop
}
}
if(GetAsyncKeyState(VK_F4)) { //if F4 is pressed
bQuit = FALSE; //make our condition FALSE, making our loop stop
}
} while(bQuit == TRUE); //setting our do while loop condition so that it loops as long as the bool variable bQuit is TRUE
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
Last edited by oib111 on Wed Jun 18, 2008 6:27 pm; edited 4 times in total |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Jun 18, 2008 6:21 pm Post subject: |
|
|
| oib111 wrote: |
Huh? What are you talking about? |
it was directed at his first post.
"setData.fde To getCursorPos()" what.
| ElectroFusion wrote: | | If your going to feed me like a baby, explain the code so i'll learn.[/b] |
MSDN MSDN MSDN MSDN MSDN MSDN MSDN MSDN MSDN MSDN MSDN
WILL EXPLAIN EVERYTHING USE THE LINKS I GAVE YOU
|
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Wed Jun 18, 2008 6:27 pm Post subject: |
|
|
I just didn't understand all the bExit and stuff
EDIT: how would I make multiple points? so like people can get multi points [same hotkeys]
and when you press to setCursorPos it sets to one, then another, then another.
_________________
| qwerty147 wrote: |
| ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Wed Jun 18, 2008 8:02 pm Post subject: Re: [C++]storing information |
|
|
| ElectroFusion wrote: | I'm making a program, where when you press f3 it gets the cursor pos and sets it in a thing so its usable, something like
GetAsyncKeyState(VK_F5){
setData.fde To getCursorPos()
}
GetAsyncKeyState(VK_F6){
setCursorPos(getData.fde)
} |
Is that supposed to be C++? Looks like VB
_________________
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Wed Jun 18, 2008 8:10 pm Post subject: |
|
|
Pillboi (or maybe blankrider) made something like this a while ago and released it along with the source. Go search for it and look at the code.
_________________
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Wed Jun 18, 2008 8:25 pm Post subject: |
|
|
| ElectroFusion wrote: | I just didn't understand all the bExit and stuff
EDIT: how would I make multiple points? so like people can get multi points [same hotkeys]
and when you press to setCursorPos it sets to one, then another, then another. |
Then go learn C++. Don't keep asking what everything means and expect us to teach you everything. There are so many fucking tutorials out there. Because it seems like your lacking all the basics.
For your question.
1. Make a global variable to hold a count.
2. Increase the count everytime the key is pressed
3. Store point in an Array (Hopefully this word is familiar to you) at the count index.
And finally, I'm really sick of telling you.
It isn't setCursorPos. It is SetCursorPos.
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jun 18, 2008 8:44 pm Post subject: |
|
|
Seriously though dude, CASE SENSITIVE...for God's sake. Lurc ftw. Anyway, don't you have to use linked lists (don't quite remember their use, but isn't this is) to resize the array? Or do you want a max amount of points?
| Code: |
static int count = 0;
bool bQuit = TRUE;
POINT point[100];
string points[100];
do {
if(GetAsyncKeyState(VK_F3)) {
if(GetCursorPos(&point)) {
if(count <= 100) {
count++;
sprintf_s(points[count-1], 255, "Mouse Coordinates: %d, %d",
point[count-1].x, point[count-1].y);
}
}
}
if(GetAsyncKeyState(VK_F5)) {
if(!SetCursorPos(point[count-1].x, point[count-1].y)) {
bQuit = FALSE;
}
}
if(GetAsyncKeyState(VK_F4)) {
bQuit = FALSE;
}
} while(bQuit == TRUE);
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Wed Jun 18, 2008 9:10 pm Post subject: |
|
|
| oib111 wrote: | Seriously though dude, CASE SENSITIVE...for God's sake. Lurc ftw. Anyway, don't you have to use linked lists (don't quite remember their use, but isn't this is) to resize the array? Or do you want a max amount of points?
| Code: |
static int count = 0;
bool bQuit = TRUE;
POINT point[100];
string points[100];
do {
if(GetAsyncKeyState(VK_F3)) {
if(GetCursorPos(&point)) {
if(count <= 100) {
count++;
sprintf_s(points[count-1], 255, "Mouse Coordinates: %d, %d",
point[count-1].x, point[count-1].y);
}
}
}
if(GetAsyncKeyState(VK_F5)) {
if(!SetCursorPos(point[count-1].x, point[count-1].y)) {
bQuit = FALSE;
}
}
if(GetAsyncKeyState(VK_F4)) {
bQuit = FALSE;
}
} while(bQuit == TRUE);
|
|
First of all, the "while (bQuit == TRUE)" is misleading.
Second, doing the "count-1" is going to throw some an exception about the index being out of the bounds of the array or something.
(Remember, 0 - 1 = -1)
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Wed Jun 18, 2008 9:12 pm Post subject: |
|
|
My bad. Whatever just check if its <= to 100 or > 0
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Jun 18, 2008 9:13 pm Post subject: |
|
|
| You're not letting the loop sleep at all.
|
|
| Back to top |
|
 |
ElectroFusion Grandmaster Cheater
Reputation: 0
Joined: 17 Dec 2006 Posts: 786
|
Posted: Wed Jun 18, 2008 9:33 pm Post subject: |
|
|
Thanks much guys. I knew it was possible.
I know you guys won't care, but im going to do a dword for both x and y, and this way... well anyway. thanks.
_________________
| qwerty147 wrote: |
| ghostonline wrote: |
what world are you in?
|
bera
but i live in NZ
|
|
|
| Back to top |
|
 |
|