Sign in to follow this  
Followers 0
RamonBastos

Weird.. Can someone explain this?

18 posts in this topic

Well, My first topic =D

I tried to make a macro to a MMORPG that im playing, but looks like it have a protection to keyboard commands. Yea, this is normal, but the curious thing is, its not a 100% protection, i mean, if i leave the macro running, sometimes it "press" they key, sometimes it doesnt..

This is my very simple code:

$i = 0

Sleep(2000)

While $i <= 10

Send("{TAB}")

Sleep(500)

MouseClick("right",156,650)

Sleep(6000)

WEnd

Thats all i need, but its taking tooo long to press TAB, (if i use it on Notepad, works fine).

I tried making a code like that:

$i = 0

Sleep(2000)

While $i <= 10

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Send("{TAB}")

Sleep(500)

MouseClick("right",156,650)

Sleep(6000)

WEnd

And now it "press" TAB more often than the first, but still dont work as i wanted..

Any tips? anyway to fix it?

Thanks

Share this post


Link to post
Share on other sites



perhaps you should use ControlSend instead, it makes sure that your game is getting the keystroke instead of another program

Share this post


Link to post
Share on other sites

No. more often than the first code, but both take longer than six seconds..

-----

To use controlsend i need ClassNN right? i can't get it for my game.. (with the windowspy)

Share this post


Link to post
Share on other sites

No. more often than the first code, but both take longer than six seconds..

-----

To use controlsend i need ClassNN right? i can't get it for my game.. (with the windowspy)

You do know you have a Sleep(6000) in your loop right?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You do know you have a Sleep(6000) in your loop right?

Yea, after i click, its supposed to wait 6 seconds then press TAB, but sometimes it Click.. Then Click again with no TAB, and sometimes it press TAB twice or more before click.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Opt("SendKeyDownDelay", 1) ;1 millisecond

Opt("MouseClickDownDelay", 10) ;10 milliseconds

from help file ?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

$i = 0 ; setting a variable, insignificant amount of time taken
Sleep(2000) ; so far: 2000
While $i <= 10 ; a loop, included times will be multiplied by 11 (0-10, 11)
Send("{TAB}") ; can take up to a second since it opens a dll, calls a function, then returns the value and sets an error if needed, so far: 2100
Sleep(500) ; sofar: 2600
MouseClick("right",156,650) ; can take up to a second... etc., so far: 2700
Sleep(6000) ; sofar : 8700
WEnd
; end total: 75700ms; 1m 15s 700ms

you will want to reduce it from 6000 to 4000 or 2000 if you really need a delay that long, end time will still be 31900ms, 31s 900ms

edit: and your problem is that something else is getting the keystrokes, try ControlSend like i said

Edited by skyboy

Share this post


Link to post
Share on other sites

Opt("SendKeyDownDelay", 1) ;1 millisecond

Opt("MouseClickDownDelay", 10) ;10 milliseconds

from help file ?

Sorry?

$i = 0 ; setting a variable, insignificant amount of time taken
Sleep(2000) ; so far: 2000
While $i <= 10 ; a loop, included times will be multiplied by 11 (0-10, 11)
Send("{TAB}") ; can take up to a second since it opens a dll, calls a function, then returns the value and sets an error if needed, so far: 2100
Sleep(500) ; sofar: 2600
MouseClick("right",156,650) ; can take up to a second... etc., so far: 2700
Sleep(6000) ; sofar : 8700
WEnd
; end total: 75700ms; 1m 15s 700ms

you will want to reduce it from 6000 to 4000 or 2000 if you really need a delay that long, end time will still be 31900ms, 31s 900ms

edit: and your problem is that something else is getting the keystrokes, try ControlSend like i said

Hummmmmm... You mean my loop is taking 1m 15s 700ms? O.O

Can you help me with ControlSend? I tried but i can't get it right.. =/

Share this post


Link to post
Share on other sites

Sorry?

In help file for Opt() func, read coment (Param column) for SendKeyDownDelay

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Sends a string of characters to a control.

Parameters

title The title of the window to access.

text The text of the window to access.

controlID The control to interact with. See Controls.

string String of characters to send to the control.

flag [optional] Changes how "keys" is processed:

flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow.

flag = 1, keys are sent raw.

Return Value

Success: Returns 1.

Failure: Returns 0 if window/control is not found.

Remarks

ControlSend works in a similar way to Send but it can send key strokes directly to a window/control, rather than just to the active window.

ControlSend is only unreliable for command prompts as that works differently to normal windows (seems to check physical states rather than accepting the keystroke messages). For normal windows ControlSend should be way more reliable than a normal Send - and yes it does send shift, ctrl, alt etc.

As mention in the Send help the keyboard that send different chars when in CAPS LOCK and using the Shift Key cannot be simulated. An example is the Czech Keyboard. A good workaround is to use the ControlSetText.

The control might first need to be given focus with the ControlFocus command, specially when referencing an controlID created by the script itself.

Opt("SendKeyDelay",...) alters the the length of the brief pause in between sent keystrokes.

Opt("SendKeyDownDelay",...) alters the length of time a key is held down before being released during a keystroke.

Share this post


Link to post
Share on other sites

ControlSend("Grand Fantasia", "","", "{TAB}")

I dont know what to put at "text" and ControlID parameter :S

Share this post


Link to post
Share on other sites

text is optional, a blank string will match any/no text (i almost always use a blank string); control id has to be the id of the control within the window you're sending it to, if it uses directx or similar for rendering the client area, you won't find a control id (use the autoit window info tool)

Share this post


Link to post
Share on other sites

Hummm, i guess there isnt a control ID then?

Posted Image

Any other way to bypass it?

Share this post


Link to post
Share on other sites

from help file

SendKeepActive Attempts to keep a specified window active during Send(). (thisone is becose if anyone suspect that something else is getting the keystrokes)

there is also

WinActivate("")

WinWaitActive("")

If WinActive("winname") Then send()

and whall text from the help file for SendKeyDownDelay

Alters the length of time a key is held down before being released during a keystroke. For applications that take a while to register keypresses (and many games) you may need to raise this value from the default. A value of 0 removes the delay completely.

Time in milliseconds to pause (default=5).

If you rly determanded to try ControlSend() try with no ID to see if itl work

ControlSend("Grand Fantasia", "","", "{TAB}")

Thats from me for this post, gn all :)


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

from help file

SendKeepActive Attempts to keep a specified window active during Send(). (thisone is becose if anyone suspect that something else is getting the keystrokes)

there is also

WinActivate("")

WinWaitActive("")

If WinActive("winname") Then send()

and whall text from the help file for SendKeyDownDelay

If you rly determanded to try ControlSend() try with no ID to see if itl work

Thats from me for this post, gn all :)

THanks for the help =D

But i tried all what u said..

Tried SendKeepActive, tried If WinActive("winname") Then send(), tried to change the delay..

nothing worked =/, it still pressing TAB whenever he wants.. weird =/

Share this post


Link to post
Share on other sites

Run autoit and the game as administrator and it should send() keys just fine, however you will not be able to use controlsend() to send keys to your quickbar to activate skills. If anyone knows how to activate skills in this game while the game window is minimized..please enlighten me. I have tried controlsend, postmessage/sendmessage.. I can send keys to the login screen and chatbox while ingame if i press enter and bring up the chatbox, but other then that the keys are not acknowledged.

Share this post


Link to post
Share on other sites

If the problem is that the key presses or mouse clicks don't register in the game, it may be a matter of the input happening too quickly for the game to recognize it. This can be fixed by making the input delays longer for key presses and mouse clicks.

Same thing happened to a game (vertical shooter) I tried making a turbo fire button for. My initial attempt worked for the first few seconds then the craft no longer fired anything. My script worked correctly after lengthening my key press delay to 50ms.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0