Post Reply Home » Forums » MMO Forums » 9Dragons » 9Dragons Discussions

Skill Trainer - KeyJamming via software : 9Dragons Discussions

Posted: September 20th, 2007
cymdiaz
I am Trying to write a skill trainer in C# to avoid physical keyjamming. The idea is to be able to level heals and buffs by selecting any player with an open stall in town and then have the program go into a cycle of applying skills, buffs and regenerate VE; i.e. software-keyjamming ;-).

The idea would be very similar to keyjamming: I would have a simple program "type" numbers for the skills I want to raise and "P" after a set period of time to regenerate OR I could toggle in and out of combat mode and have my satchets raise VE before the next spell is cast. That's it, it's the heals and buffs I want to raise; the fighting skills, gold, and dropped objects are part of my gaming experience, don't care to hack those (but heals and buffs take FOREVER and I do want my healer character to be of real help in parties)

Does anybody know why functions like SendKeys, SendMessage or SendInput won't work on 9Dragons. Better still, does anybody know HOW to make them work?

Spy++ tells me that 9Dragons gets a WM_Keydown, WM_Char, WM_Keyup with every key stroke. That is, whenever I type a character like "1" for example while 9Dragons is active, 9Dragons receives three messages: WM_Keydown, WM_Char,WM_Keyup

If I try SendKeys, I get an error with 9Dragons that I assume is because 9Dragons wont accept messages from a third program (I didn't bother with sendmessage because I assume it will fail for the same reason).

I tried SendInput which I understood emulated a keyboard stroke as if it were coming from the keyboard. SendInput works perfect but not for 9Dragons: I wrote a short "Hello World" timed routine and started up several windows of Notepad, Explorer, Word, etc. SendInput would send the keystrokes and depending on what window was currently active, that window would receive the text as if it where typed. However, SPY informs me that what Notepad received was a series of WM_Command messages and WM_CtlColorEdit (the text was received and printed ok). MS Word prints the words, but Spy doesn't seem to be able to capture any message and Explorer captures the text through a WM_NULL command. So all of this is saying is that I am ignorant when it comes to the way SendInput really emulates a keystroke and/or the ways that programs capture the keystroke. (By the way, the keystrokes that come from the keyboard generate the same response from SPY so I assume that SendInput is doing it's job).

9Dragons, however, ignored the keystrokes generated by Sendinput completely. My "Hello World" was sending a letter P spaced 4 seconds apart. I got the program running; made sure it was issuing the P's by looking in Notepad for the capture; then selected 9Dragons and typed in a "1" command (a skill) to make sure that 9Dragons was responding to the keyboard. waited, waited what should have been at least four P's then typed in another "1" command. Sure enough, I could see my two "1" commands on SPY, but no P commands.

My assumption is that SendInput is to high level and that the keyboard strokes are intercepted by another program at a lower level (as of yet unidentified by me) who then Sends a Message to 9Dragons and that 9Dragons accepts this message because it comes from an authorized source (presumable game guard).

I was wondering if you guys can comment on these assumptions and help me create a good soft-keyjammer.

ppp

Thanks
Posted: September 20th, 2007
User avatar
administrator
Total Posts:29891 Joined:2002
Can members say yay or nay to this being moved to a confirmed section.
Posted: September 20th, 2007
Total Posts:33 Joined:2007
The reason it does not work is 2 reasons. First it's in part because of DirectX. Second is how the keyboard is handled in 9Dragons. You must make use of the Input Method Manager (IMM).

IMEs (Input Method Editors) map keyboard input to components or other language elements specific to a selected language. In a typical scenario, the user types keys that represent pronunciation of a character. If the IME recognizes the pronunciation as valid, the chosen word is sent to the application through a series of Microsoft Windows WM_CHAR messages. Because the IME works at a level below the application by intercepting keyboard input, the presence of an IME is transparent to the application.

When a user interacts with an IME to input characters, the IMM sends messages to the application to notify it of the events.

I hope now you can see why it doesn't work. If you're confused then basically you must send keyboard data through a keyboard driver (beneath the application level). Search MSDN for IMM, IME, Input Method Manager, Input Method Editor, IActiveIME, IMEProcessKey and you should find enough documentation to get you started.

Alternatively, you can accomplish this daunting task by simply using AutoIT. If you still wish to make your own application you can spy on the API calls sent from AutoIT to see how it does it. I recommend using API Monitor, even though it's a bit old. I believe it comes with the Windows Support Tools package and is free for download from Microsoft.

P.S. AutoIT also uses IME APIs.
Posted: September 21st, 2007
cymdiaz
Thanks for the brief, will try to read about IMM and IME this weekend.

I did not know about AutoIT until your post, downloaded v3 and tried the following script:

Global $Paused
HotKeySet("{F10}", "pauseKeyJamming")
HotKeySet("{F11}", "stopKeyJamming")
Opt("SendKeyDelay", 50) ;5 milliseconds
Opt("SendKeyDownDelay", 500) ;1 millisecond

pauseKeyJamming()
While 1
Sleep(2000)
Send("1",1)
WEnd

; Press F11 to terminate script, F10 to "pause" (initial state is paused)
Func stopKeyJamming()
HotKeySet("{F10}") ;release resources
HotKeySet("{F11}") ;release resources
exit 0
EndFunc

Func pauseKeyJamming()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")

EndFunc

Send didn't work for 9D.

I tried different variations on delay times, none worked on 9D (the script worked fine for calc.exe, notepad, word, etc.) verified function was working toggling in and out of 9D into Notepad and it does. Got same result with AutoIT version 3 as c# send.

I will read this weekend; really appreciate your thoughts and suggestions.

Thanks
Posted: September 21st, 2007
cymdiaz
Sorry, forgot to mention in my last post that the HOTKEYS F10 and F11 (for pause and termination in the AutoIT script) where functional from inside 9D (i.e. I could get a response from my script - pause and terminate while playing 9D). Also forgot to mention that both options for Send where used 0 and 1. Only tried sending letter 1
Posted: October 1st, 2007
astradig
Did you make it work with 9dragons after all ?
Ready to join the community? Click here and see all of the benefits!
blue large dotWho is online
Users browsing this forum: No registered users and 4 guests
Post Reply