The ultimate key to programming is to have a detailed idea of exactly what has to be accomplished to get the job done. so first you have to have a "job description". Example: Find and harvest a single tree in the PkHonor RSPS
2nd step is an outline of those actions that will accomplish the job as described in "job description"
to do that you, if possible, have to walk the steps, either in the actual environment where the job has to be completed ( in this case, ingame) or you need to create an environment that mimic's the real environment that the program will have to function in)
In the case of game scripting the 2nd step is fairly easy if a bit boring. you simply (and repeatedly) do the steps necessary to accomplish the job. Write down each step you do in as much detail as possible. Do all necessary steps to finish the job. The outline of steps then becomes the outline for your script. each step in the outline becomes a comment or remark statement in the script you want to create. So the top level design would look something like this...
; script to harvest a single tree in PkHonor ; step 1: search the screen for a tree ; the trick here is how to tell your script what a tree looks like on the screen ; especially when the tree colors and shapes are changing ; step 1a: if there are no trees on the screen ; quit trying to harvest ; go to a new location ; go back to step 1 ; step 2: move to tree ; get the location of the tree on the screen ; move your character to that location ; step 3: begin cutting down tree ; do one or more actions needed to cut down tree ; note actions may change depending on what tool you use for cutting ; what kind of tree it is... ; if you get attacked while harvesting... ; other unforseen circumstances. like a bio break, etc ; step 4: is tree down? ; trick here is how to tell if the tree is down? ; step4a: if yes ; pick up tree loot if any ; go back to step 1 ; step4b: If no ; either wait for tree to fall down or... ; go back to step 3 and keep wacking on tree ; step5: end routine ; given that we're in an infinite loop above how ; would you ever get here?What makes this whole thing a long term exercise is that the more you fill in the details of what you have to do the clearer the idea of what you need to do becomes. It's something called an "iterative procedure" where you write stuff down, try it out, figure out what's messed up, go fix it, write what you did to fix it down, go back to the beginning and do it all over again. And you do that until the job is as complete as you want to make it.