Hello, i've got a small problem that I can't solve so far. Trying to rewrite my vermin bot to work with waypoints. After trying MoveToPos waypoints that don't want work for unknown reason ( clicks just once and then script turns off ) I've decided to try reading waypoints from file and processing them like RuffScruff did in his autoit bot:
Code:
Func FollowWaypoint($_waypointfile)
Debug("Entering ")
$WaypointsArray = WaypointFiletoArray($_waypointfile)
$a_size1 = UBound($WaypointsArray)
;; Set Passive Skills
;; Begin moving to each waypoint
For $s_i = 0 To $a_size1-1 Step 1
$_x =$WaypointsArray[$s_i][0]
$_y =$WaypointsArray[$s_i][1]
$_z =$WaypointsArray[$s_i][2]
;; Shoot at enemies nearby
AttackNearbyEnemies(40)
;;Loot around last waypoint and track that value
Global $lastwp_x = $_x
Global $lastwp_y = $_y
Global $lastwp_z = $_z
Debug("Now moving to Waypoint " & $s_i+1)
MoveToPosClicky($_x,$_y,$_z,25)
Next
EndFunc
Problem goes with this function:
Code:
;;--------------------------------------------------------------------------------
;; WaypointFiletoArray($s_file)
;; Writes the waypoint file to a 2-D array. Returns the array.
;;--------------------------------------------------------------------------------
Func WaypointFiletoArray($s_file)
$data = FileRead($s_file)
$a_temp1 = StringSplit($data, @CR,2)
$a_size1 = UBound($a_temp1)
Local $a_waypoints[$a_size1][3]
For $s_x = 0 To $a_size1-1 Step 1 ;skip blank line in the end as well
$a_temp2 = StringSplit($a_temp1[$s_x], ";",2)
For $s_y = 0 To 2 Step 1
$a_waypoints[$s_x][$s_y] = $a_temp2[$s_y]
Next
Next
Return $a_waypoints
EndFunc
Every time I try to load waypoints from Bastion's keep it gives me error:
Code:
---------------------------
AutoIt Error
---------------------------
Line 357
$a_waypoints[$s_x][$s_y] = $a_temp2[$s_y]
$a_waypoints[$s_x][$s_y] = ^ ERROR
Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.
---------------------------
OK
---------------------------
But when I try to load waypoints from somewhere else they just work flawlessly. It's like autoit can't operate in town or what?
"Bad" waypoints ( from Bastion's keep ):
Code:
399.57919311;421.0678710;0.89186084270
399.57919311;421.0678710;0.89186084270
395.76617431;422.43090820;0.3954666554
388.58755493;425.07180786;0.5065044164
388.58755493;425.071807868;0.5065044164
388.58755493;425.07180786;0.5065044164
Working waypoints ( from core ) :
Code:
186.586944580078;721.316833496094;-45.7479248046875
199.489242553711;722.396301269531;-39.6817359924316
212.397521972656;722.004272460938;-32.6083374023438
225.661193847656;721.361633300781;-25.1083526611328
238.57958984375;720.817626953125;-16.7190704345703
251.466918945313;721.917175292969;-10.7774467468262
264.343292236328;720.542846679688;-6.53838205337524
303.552032470703;720.76513671875;0.637154281139374