Alright, I spent some time debugging and found two issues with when I ran it:
1. The $globalTolerance was too high when doing an imagesearch for $imageClearSlotProf
Explanation: The imagesearch allowed for too much flexability when searching for a blank spot... I think just the border alone was enough to "match" when doing a search even though slots were taken up. Tightening up the requirements to be a bit more exact (20 instead of 80) was enough to match when a slot was blank instead of used.
Setting the tolerance to "20" fixed this for me. [lines 353 & 376]
Code:
$anyOpenSlot = _imagesearch($imageClearSlotProf, 1, $x, $y, 20)
2. The imagesearch couldn't find my "overview" image. So, I re-created it using the overview icon instead of the text. Works every time now.
Screenshot (Prt Scr button), open up MS Paint, paste, selection box, select most of the icon to the left of "Overview" in the professions panel, then CROP. Save as PNG as the same name in the same place as the original OverviewProf.PNG.