SolvedAHK script for X-Walking.

Posts 18 of 8 · Page 1 of 1
AHK script for X-Walking.
I've never tried AHK but I've taken a few java classes at my college so know the basics of programming.
What im trying to make.
Step 1, let user select a location on the screen to lock ( for use on realm you would lock the location of the x on your swf)

Step 2, let the user select a hotkey to correspond to left mouse click, when desired hotkey is held mouse click is held then moved to the center of the screen.

Step 3, when desired hotkey is let go stop holding left mouse click

Not really looking for anyone too just give me the answer, just some tips on ahk before I start would be greatly appreciated.
I'll put pastebin's of the source as I'm going.
I think he has the most experience with AHK-scripts, maybe he wants to help you @ll1312ll
Quote Originally Posted by The_En|D View Post
I think he has the most experience with AHK-scripts, maybe he wants to help you @ll1312ll
Thanks

@OblivionPO
Im not sure if i got your problem right, english is not my first language.
and i have not worked with ahk a while but i try my best.

example code:

F9::
{
MouseGetPos,x,y
sleep, 5000
MouseMove %x%, %y%
}

this code means if you press F9 it gets the mouse position into variables x and y
than sleep 5sec
and than move the mouse back to old position
Ahk has also some easy to use comands to check if the mousebutton is pressed down:

GetKeyState, State, LButton, P
If State = D # D means down

and now let a loop permacheck for the button:

example:

F9::
MouseGetPos,x,y
loop
{
sleep, 5000
GetKeyState, State, LButton, P
If State != D
{
MouseMove %x%, %y%
break
}
}
exitapp

When f9 is pressed this code gets the mouseposition and than checks every 5 seconds if the mousebutton is still down
and if its not down anymore move the mouse back.
Hope this helped you a bit
Quote Originally Posted by OblivionPO View Post
I've never tried AHK but I've taken a few java classes at my college so know the basics of programming.
What im trying to make.
Step 1, let user select a location on the screen to lock ( for use on realm you would lock the location of the x on your swf)

Step 2, let the user select a hotkey to correspond to left mouse click, when desired hotkey is held mouse click is held then moved to the center of the screen.

Step 3, when desired hotkey is let go stop holding left mouse click

Not really looking for anyone too just give me the answer, just some tips on ahk before I start would be greatly appreciated.
I'll put pastebin's of the source as I'm going.
1- MouseGetPos, using the active window's coords(it does that by default so don't worry)

2- Holding keys down:
Send W : it presses the W a single time
Send {W down} : holds the W key down
Send {W up} : releases the W key
KeyWait W : waits for W to be pressed/released to continue

Making the user choose his X location with Alt + T:

Code:
!T::
MouseGetPos, coordx, coordy
return
Using the letter T as our hotkey:

Code:
T::
MouseMove, coordx, coordy    ; moves cursor to the X
Send {LButton down}          ; holds click
MouseMove, 200, 200          ; any coord in the middle of the screen
KeyWait, T                   ; waits for the T to be released
Send {LButton up}            ; releases click
return
You may tweak it a bit. I don't think we need to make the user choose the X location everytime, just find the default one and try to put it directly there without variables.

edit: lol got ninja'd. I think I made mine simpler, though - the KeyWait makes the usage of loopchecking unnecessary.
Plus is right i forgot about keywait should be even simpler with that.
Edit:

Bonustip:
never forget to set an exit hotkey in your test scripts.
like:

F12::
exitapp

because ahk can suck a lot sometimes. The script you want for example could bind your mouse to the center of the screen with just one simple syntax mistake.

U can search for my old releases i just tested 'ASSCursor' and it still works its marked as outdated..
It just dont change the cursor size anymore.. but i think its a windows10 problem.
And check for my autotradebot it uses the mouse a lot and i hope i coded it understandable for beginners..
Maybe it helps u getting the basics.
Quote Originally Posted by ll1312ll View Post
Plus is right i forgot about keywait should be even simpler with that.
Edit:

Bonustip:
never forget to set an exit hotkey in your test scripts.
like:

F12::
exitapp

because ahk can suck a lot sometimes. The script you want for example could bind your mouse to the center of the screen with just one simple syntax mistake.

U can search for my old releases i just tested 'ASSCursor' and it still works its marked as outdated..
It just dont change the cursor size anymore.. but i think its a windows10 problem.
And check for my autotradebot it uses the mouse a lot and i hope i coded it understandable for beginners..
Maybe it helps u getting the basics.
All my scripts have a Reload bound to the Del key, it's an easy break for loops too
Ugh i cant tag you guys cus I'm not allowed to for some reason, So ill have to thank you guys separately. I really appreciate you helping me on this, and pointing me to what I need to know to make it work. I'm sorry I havent posted my source yet I've been mad busy with midterms :c once I have something decent to show I'll show you guys what I have.
looks solved.

/closed also 7 days inactivity.
Posts 18 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?