View previous topic :: View next topic |
Author |
Message |
sumone4life Cheater Reputation: 0
Joined: 26 Feb 2007 Posts: 27
|
Posted: Fri Mar 16, 2007 1:19 pm Post subject: KeyListen [c++] |
|
|
What i want to do is make it so ingame the user can type a string in the chat box that says something like:
'goto 119 200 20
when the user types this command i want to run a function that edits values in the game. These valeus correspond with x,y and map location.
So basically theres 2 things that i need help with..
1. How do i make a keylistener that will listen for the string "`goto" and then do a function
2. How do i extract the x, y and map number from the string... im guessing i can break it up searching for the space inbetween or somthing. But im new to c++ so im really not sure how to go about this.
p.s. Im writing this in c++
_________________
-amen |
|
Back to top |
|
|
Drkgodz Flash moderator Reputation: 2
Joined: 17 Jul 2006 Posts: 2997 Location: Houston
|
Posted: Sat Mar 17, 2007 3:05 pm Post subject: |
|
|
There would be a lot of IFs, and you would have to create something a bit like a keylogger.
_________________
|
|
Back to top |
|
|
sumone4life Cheater Reputation: 0
Joined: 26 Feb 2007 Posts: 27
|
Posted: Sat Mar 17, 2007 9:54 pm Post subject: |
|
|
well yes i know that, but i just dont know how to go about doing it... any one have any ideas or suggestions?
_________________
-amen |
|
Back to top |
|
|
Uzeil Moderator Reputation: 6
Joined: 21 Oct 2006 Posts: 2411
|
Posted: Sun Mar 18, 2007 12:37 am Post subject: |
|
|
Code: | string myString = "";
for(int i=0;i<256;i++)
{
if(getasynckeystate(i)>0)
myString=myString+chr(i);
}
if(pos(myString,"goto")>0)
{
workyoshit;
} |
I'm not a C++ guy, but the gist is there. (Some might be written in Delphi, but just grab MSDN and look up some relations.)
_________________
|
|
Back to top |
|
|
kkid28 Expert Cheater Reputation: 0
Joined: 30 Sep 2006 Posts: 110 Location: The only flat part of the planet.
|
Posted: Sun Mar 18, 2007 1:09 am Post subject: |
|
|
He heh, I'm learning this in computer science next week, disassembling a string. Are you doing console programming in C++? (well I assume but...)
You know, before I quit C++ (since we learn BASIC in computer science) I was actually looking in responding instantly as a key is pressed. I skiddied one script and found that the keys have certain numbers and it would basically loop until a key is pressed (then continue looping) and it would display the arrow you hit (in letters "UP" "DOWN"etc) through IF statements. Just a thought of something you should look into. I gave up because I couldn't find any other key numbers. ie "A" is 65
_________________
|
|
Back to top |
|
|
Uzeil Moderator Reputation: 6
Joined: 21 Oct 2006 Posts: 2411
|
Posted: Sun Mar 18, 2007 2:50 am Post subject: |
|
|
kkid28 wrote: | since we learn BASIC in computer science | Sounds more like ancient computer history
Har har.
_________________
|
|
Back to top |
|
|
sumone4life Cheater Reputation: 0
Joined: 26 Feb 2007 Posts: 27
|
Posted: Sun Mar 18, 2007 6:54 am Post subject: |
|
|
kkid28, yeaj all the keys have a numerical values... there are tables online if you are curious. Uzeil i like that alot, ill have to try that. i could search in the string for 'goto and for the numerical values..
Thanks alot ill give that a try.
_________________
-amen |
|
Back to top |
|
|
|