Post by turkmcgill on Jan 8, 2021 17:39:09 GMT -5
What is HyperPlant?
If you missed my other post on this, HyperPlant is a planting script for the AutoHotKey tool. (It's a free auto-clicker that has been around for years.) The HyperPlant script is based on an idea from CrazyCanuck and I link to his video below.
The script allows you to use a controller to rapidly plant objects as you move around the screen. In addition to being a much faster way to drop down lots of objects, it appears to be more efficient than the editor's auto-planting features. (In terms of object usage.) The script offers 10 different planting modes with different planting speeds and random variations. These are easily customizable. Further, the objects automatically rotate while you are planting them, to provide more visual variety.
Installation
1. Download and install AutoHotKey
2. Right click on your desktop, go to New, and choose "AutoHotKey Script".
3. Name the file "HyperPlant".
4. Drag this file to your task bar at the bottom of the screen.
5. Right click on the HyperPlant file and choose "Edit Script".
6. Delete anything already in the script and replace it with the HyperPlant script below.
7. Save.
Crazy Canuck's Installation video (it's the same steps as above)
Run the Script
1. Right click on the script in your task bar at the bottom of the screen.
2. Left click on HyperPlant.ahk (the script will start running).
3. Load PGA 2k21.
Important Note: While the script is running if you try to type a number on your keyboard you will get an "a" instead. If this ever happens, simply press ESC and that will exit the script. (Don't worry, this won't hurt your keyboard.)
Using HyperPlant
1. Go into the Course Editor and select an object to plant.
2. Press a number key on your keyboard (1 to 9, or 0).
3. The object you selected will begin to spin. This shows you are in HyperPlant "mode".
4. You can tap the "plant" key on your controller to plant a single object, or you can press and hold the button to HyperPlant as you scroll around on the screen.
5. When you are done HyperPlanting simply release the button on your controller.
6. To get out of HyperPlant mode (but without exiting the script), press the "`" key. (Next to the "1".) Your object will stop rotating.
7. To exit the script completely, press "ESC". You sould always do this before exiting PGA 2k21, as the script will keep running otherwise. (See note above.)
If Pressing the Button on Your Controller Doesn't Work
AutoHotKey recognized my controller (even though I only have one) as "2Joy". Your controller may be a different number, so you may have to modify the script. Here's how to do that:
1. Right click on the script in your task bar at the bottom of the screen.
2. RIGHT click on HyperPlant.ahk.
3. Left click to select "Edit Script".
4. Scroll to the bottom of the script and change the TWO references from "2Joy1" to "1Joy1". (i.e. change "$2Joy1::" to "$1Joy1::")
5. Save.
If the change above doesn't work you will have to run the test script below. It should tell you the name of your joystick to use in the script.
www.autohotkey.com/docs_1.0/scripts/JoystickTest.htm
The HyperPlant Script
Copy the script below and put it in your HyperPlant file.
What the Script is Doing
The top line indicates the number pressed on the keyboard. (If you changed this to the letter "r" for some reason, it would look like this: "$r::".
The variables "delaymin" and "delaymax" are used when planting. So when you press "1" on your keyboard, and start to plant, the script will plant an object, then choose a random number between 40 and 80 and wait that amount of time before planting again. This will continue until you release the button on your controller. Feel free to change these two numbers to whatever you like.
The line "Send, {a down}" says: "When the player presses 1 on the keyboard, virtually hold down the 'a' key." This makes the object spin continuously.
The other numbers work the same way.
The top line is triggered when you press "`" on your keyboard. (To the left of the "1".)
Pressing the "`" key exits HyperPlanting mode, so the script uses: "send {a up}" to stop pressing down on the 'a' key. The object will stop spinning and you will not be able to HyperPlant until you press another number.
The first line checks to see if the #1 button on the 2nd joystick has been pressed. (Again, you may need to change this to: "$1Joy1::")
While the button is being held down the script checks to see if the HyperPlanting mode is "on" or "off". If "toggle = 1" then it is off and we exit the the loop.
This is still part of the same 'while loop' as above. The first line creates a short delay before planting begins. This is necessary because otherwise, while you are in HyperPlanting mode, a quick tap will almost always put down 2 or more objects. (The "100" is the time in milliseconds.)
Send, {Space} - simulates pressing the spacebar.
Random, rand, %delayMin%, %delayMax%
- chooses a random number between delayMin and delayMax and saves it in the variable "rand". These values are also in milliseconds.
Sleep, %rand% - Tells the script to wait for the randomly chosen amount of time (before planting again).
Final Notes & Tips
Fast vs Slow Planting
The Course Editor seems to allow for both slow and fast planting. When you are single planting you should notice that after you place an object, there is a kind of screen refresh. This seems to save the object you just placed.
If you plant objects quickly enough the editor doesn't refresh the screen, and many objects can be placed quite fast. When you slow down or pause, the screen refreshes like normal. I don't know if the timing on this is CPU or framerate dependent, but on my PC any delayMin or delayMax values higher than 225 will switch to slow planting mode. If you are trying to move around the screen this can be jarring because everything freezes for a second or so. (But feel free to play around with higher values in the script.)
One other note, and I think I would consider this a good thing, is that when you plant a bunch of items quickly (values below 225), pressing Undo on the controller will remove EVERY item you just fast planted. This doesn't happen with slow planting.
Planting Mode 0
You will note that I'm using much larger numbers in the script for the #0 planting mode. This could be useful for placing trees. HOWEVER, be aware that you will be slow planting with this, meaning the Editor will pause and the screen will update after each object placed. This makes it difficult to smoothly move around the screen.
If you missed my other post on this, HyperPlant is a planting script for the AutoHotKey tool. (It's a free auto-clicker that has been around for years.) The HyperPlant script is based on an idea from CrazyCanuck and I link to his video below.
The script allows you to use a controller to rapidly plant objects as you move around the screen. In addition to being a much faster way to drop down lots of objects, it appears to be more efficient than the editor's auto-planting features. (In terms of object usage.) The script offers 10 different planting modes with different planting speeds and random variations. These are easily customizable. Further, the objects automatically rotate while you are planting them, to provide more visual variety.
Installation
1. Download and install AutoHotKey
2. Right click on your desktop, go to New, and choose "AutoHotKey Script".
3. Name the file "HyperPlant".
4. Drag this file to your task bar at the bottom of the screen.
5. Right click on the HyperPlant file and choose "Edit Script".
6. Delete anything already in the script and replace it with the HyperPlant script below.
7. Save.
Crazy Canuck's Installation video (it's the same steps as above)
Run the Script
1. Right click on the script in your task bar at the bottom of the screen.
2. Left click on HyperPlant.ahk (the script will start running).
3. Load PGA 2k21.
Important Note: While the script is running if you try to type a number on your keyboard you will get an "a" instead. If this ever happens, simply press ESC and that will exit the script. (Don't worry, this won't hurt your keyboard.)
Using HyperPlant
1. Go into the Course Editor and select an object to plant.
2. Press a number key on your keyboard (1 to 9, or 0).
3. The object you selected will begin to spin. This shows you are in HyperPlant "mode".
4. You can tap the "plant" key on your controller to plant a single object, or you can press and hold the button to HyperPlant as you scroll around on the screen.
5. When you are done HyperPlanting simply release the button on your controller.
6. To get out of HyperPlant mode (but without exiting the script), press the "`" key. (Next to the "1".) Your object will stop rotating.
7. To exit the script completely, press "ESC". You sould always do this before exiting PGA 2k21, as the script will keep running otherwise. (See note above.)
If Pressing the Button on Your Controller Doesn't Work
AutoHotKey recognized my controller (even though I only have one) as "2Joy". Your controller may be a different number, so you may have to modify the script. Here's how to do that:
1. Right click on the script in your task bar at the bottom of the screen.
2. RIGHT click on HyperPlant.ahk.
3. Left click to select "Edit Script".
4. Scroll to the bottom of the script and change the TWO references from "2Joy1" to "1Joy1". (i.e. change "$2Joy1::" to "$1Joy1::")
5. Save.
If the change above doesn't work you will have to run the test script below. It should tell you the name of your joystick to use in the script.
www.autohotkey.com/docs_1.0/scripts/JoystickTest.htm
The HyperPlant Script
Copy the script below and put it in your HyperPlant file.
#MaxThreadsPerHotkey 2
toggle = 1
$1::
toggle := 0
delaymin := 40
delaymax := 80
Send, {a down}
return
$2::
toggle := 0
delaymin := 60
delaymax := 120
Send, {a down}
return
$3::
toggle := 0
delaymin := 50
delaymax := 200
Send, {a down}
return
$4::
toggle := 0
delaymin := 70
delaymax := 110
Send, {a down}
return
$5::
toggle := 0
delaymin := 90
delaymax := 150
Send, {a down}
return
$6::
toggle := 0
delaymin := 80
delaymax := 220
Send, {a down}
return
$7::
toggle := 0
delaymin := 100
delaymax := 180
Send, {a down}
return
$8::
toggle := 0
delaymin := 130
delaymax := 200
Send, {a down}
return
$9::
toggle := 0
delaymin := 250
delaymax := 500
Send, {a down}
return
$0::
toggle := 0
delaymin := 500
delaymax := 1500
Send, {a down}
return
$`::
toggle := 1
Send, {a up}
return
$2Joy1::
While GetKeyState("2Joy1") {
If toggle = 1
break
If A_TimeSinceThisHotkey > 100
Send,{Space}
Random, rand, %delayMin%, %delayMax%
Sleep, %rand%
}
return
Esc::ExitApp
What the Script is Doing
$1::
toggle := 0
delaymin := 40
delaymax := 80
Send, {a down}
return
The top line indicates the number pressed on the keyboard. (If you changed this to the letter "r" for some reason, it would look like this: "$r::".
The variables "delaymin" and "delaymax" are used when planting. So when you press "1" on your keyboard, and start to plant, the script will plant an object, then choose a random number between 40 and 80 and wait that amount of time before planting again. This will continue until you release the button on your controller. Feel free to change these two numbers to whatever you like.
The line "Send, {a down}" says: "When the player presses 1 on the keyboard, virtually hold down the 'a' key." This makes the object spin continuously.
The other numbers work the same way.
$`::
toggle := 1
Send, {a up}
return
The top line is triggered when you press "`" on your keyboard. (To the left of the "1".)
Pressing the "`" key exits HyperPlanting mode, so the script uses: "send {a up}" to stop pressing down on the 'a' key. The object will stop spinning and you will not be able to HyperPlant until you press another number.
$2Joy1::
While GetKeyState("2Joy1") {
If toggle = 1
break
The first line checks to see if the #1 button on the 2nd joystick has been pressed. (Again, you may need to change this to: "$1Joy1::")
While the button is being held down the script checks to see if the HyperPlanting mode is "on" or "off". If "toggle = 1" then it is off and we exit the the loop.
If A_TimeSinceThisHotkey > 100
Send,{Space}
Random, rand, %delayMin%, %delayMax%
Sleep, %rand%
}
This is still part of the same 'while loop' as above. The first line creates a short delay before planting begins. This is necessary because otherwise, while you are in HyperPlanting mode, a quick tap will almost always put down 2 or more objects. (The "100" is the time in milliseconds.)
Send, {Space} - simulates pressing the spacebar.
Random, rand, %delayMin%, %delayMax%
- chooses a random number between delayMin and delayMax and saves it in the variable "rand". These values are also in milliseconds.
Sleep, %rand% - Tells the script to wait for the randomly chosen amount of time (before planting again).
Final Notes & Tips
Fast vs Slow Planting
The Course Editor seems to allow for both slow and fast planting. When you are single planting you should notice that after you place an object, there is a kind of screen refresh. This seems to save the object you just placed.
If you plant objects quickly enough the editor doesn't refresh the screen, and many objects can be placed quite fast. When you slow down or pause, the screen refreshes like normal. I don't know if the timing on this is CPU or framerate dependent, but on my PC any delayMin or delayMax values higher than 225 will switch to slow planting mode. If you are trying to move around the screen this can be jarring because everything freezes for a second or so. (But feel free to play around with higher values in the script.)
One other note, and I think I would consider this a good thing, is that when you plant a bunch of items quickly (values below 225), pressing Undo on the controller will remove EVERY item you just fast planted. This doesn't happen with slow planting.
Planting Mode 0
You will note that I'm using much larger numbers in the script for the #0 planting mode. This could be useful for placing trees. HOWEVER, be aware that you will be slow planting with this, meaning the Editor will pause and the screen will update after each object placed. This makes it difficult to smoothly move around the screen.