-
-
Save fanthos/2db2ea4260459dd96b76d974ff672598 to your computer and use it in GitHub Desktop.
| #IfWinActive, Plants vs. Zombies | |
| CoordMode, Mouse, Client | |
| SetMouseDelay, 0 | |
| SetDefaultMouseSpeed, 0 | |
| ClickAndRet(x) { | |
| MouseGetPos, xold, yold | |
| MouseMove, x*60+60, 40 | |
| MouseClick | |
| MouseMove, xold, yold | |
| MouseClick | |
| } | |
| 1::ClickAndRet(1) | |
| 2::ClickAndRet(2) | |
| 3::ClickAndRet(3) | |
| 4::ClickAndRet(4) | |
| 5::ClickAndRet(5) | |
| 6::ClickAndRet(6) | |
| 7::ClickAndRet(7) |
I havn't use this script for a long time, so not sure about 3D acceleration.
Understandable, I've been looking more into it and I think I might have figured it out.
Thanks for your time and replying to an old post!
And where to throw the file
And where to throw the file
@Daniilyus
This is AHK script, so it can placed on anywhere and run it with AHK.
A bit late to the party. it does work without 3d acceleration but just wondering if I would put it for the 7th line so it would work with 2560x1440? if you don't know its all good. it's working fine if I turn off acceleration.
I havn't play this game for awhile. The 7th line contains 3 numbers converts index number(1-7) to mouse pixel point on the toolbar button. If the result point is different, just manually adjust the numbers and make sure the mouse cursur is on the button correctly.
Not sure mouse works on 3d acceleration or not, just test it. You can comment out L8-L10(mouse click and return) and find the numbers.
I don't use this site so i hope this isn't poor etiquette for a reply section but here's what i came up with that works. It's for 1920x1080 fullscreen. You can use AHK window spy which is installed with AHK by default to find the coordinates and make the calculations to adjust in xpos := x * 106 + 332. x is the number of the column 106 is the horizontal distance between centers of columns and + 332 is the offset from the left edge of the screen to the center of the first column minus 106. I'm not sure why the formula was structured like that in the initial post but I just ran with it, it's probably optimal and I just don't understand it. Basically find the center of the first column (cofc), the center of the second column, third, fourth, and more if you'd like, then average it out to find 106 then take the cofc (which is 438) - 106, that is your 332. I also added the rest of the missing columns and a kill script code even if its a bit pointless. I removed the second mouseclick because it seemed to grab the plant and then plant it when it returns automatically.
#IfWinActive, Plants vs. Zombies
CoordMode, Mouse, Client
SetMouseDelay, 0
SetDefaultMouseSpeed, 0
ClickAndRet(x) {
MouseGetPos, xold, yold
MouseMove, x*106+332, 80
MouseClick
MouseMove, xold, yold
}
1::ClickAndRet(1)
2::ClickAndRet(2)
3::ClickAndRet(3)
4::ClickAndRet(4)
5::ClickAndRet(5)
6::ClickAndRet(6)
7::ClickAndRet(7)
8::ClickAndRet(8)
9::ClickAndRet(9)
f12::exitapp
@Goldentaco11797
You are right.
The numbers are calculated by actual mouse position for left most and right most buttons and calculated by hand.
I got my numbers by only a few of calculate.
I havn't use this script for a long time, so not sure about 3D acceleration.
You can try to comment out L8-L10, then press key 1-7 to check if mouse pointer is at right posotion.