Advertisement
Guest User

Untitled

a guest
Oct 14th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.52 KB | None | 0 0
  1. #include "GWA².au3"
  2. Global $TLOAD = "4000"
  3.  
  4. If WinExists("Guild Wars") Then
  5.     Initialize(WinGetProcess("Guild Wars"))
  6. Else
  7.     Exit
  8. EndIf
  9.  
  10. While 1
  11.     Kill()
  12. WEnd
  13.  
  14.  
  15. Func Kill()
  16.             $MapID = GetMapID()
  17.     If $MapID <> 165 Then
  18.         TravelTo(165)
  19.     EndIf
  20.     RndSleep(1000)
  21.     Do
  22.     $oldX = DllStructGetData(GetAgentByID(-2), 'X')
  23.     $oldY = DllStructGetData(GetAgentByID(-2), 'Y')
  24.     Move(633,7270, 10)
  25.     $newX = DllStructGetData(GetAgentByID(-2), 'X')
  26.     $newY = DllStructGetData(GetAgentByID(-2), 'Y')
  27.     Until $oldX <> $newX And $oldY <> $newY
  28.     LOADOUT()
  29.     RndSleep(100)
  30.     $globaltime = TimerInit()
  31.     waitMove(2425,5834)
  32.     RndSleep(100)
  33.     local $fireimp = GetItemBySlot(4, 1)
  34.     UseItem ($fireimp)
  35.     RndSleep(250)
  36.     waitMove(2748,4199)
  37.     $foe = DllStructGetData(GetNearestEnemyToAgent(-2), 'ID')
  38.     Sleep(175)
  39.     Do
  40.        
  41.     $foe = DllStructGetData(GetNearestEnemyToAgent(-2), 'ID')
  42.     Sleep(250)
  43.     If GetDistance($foe,-2) < 1500 Then
  44.         Attack($foe)
  45.         RndSleep(300)
  46.     Else
  47.         ExitLoop
  48.     EndIf
  49.     Until GetDistance($foe,-2) > 1500 Or TimerDiff($globaltime) > 125000
  50.     rndSleep(750)
  51.     abandon()
  52. EndFunc
  53.  
  54. func waitMove($x, $y)
  55.     ; set vars
  56.     $var = 0
  57.     if $var <> 0 then
  58.         $vx = rndNum($var)
  59.         $vy = rndNum($var)
  60.     else
  61.         $vx = 0
  62.         $vy = 0
  63.     endif
  64.  
  65.     $dist = 100
  66.     $coords_x = $x + $vx
  67.     $coords_y = $y + $vy
  68.     $blocked = 0
  69.     $complete = true
  70.     $move_timer = TimerInit()
  71.  
  72.  
  73.     ; start waiting
  74.     do
  75.         sleep(100)
  76.  
  77.         $cur_coordsx = DllStructGetData(GetAgentByID(-2), 'X')
  78.         $cur_coordsy = DllStructGetData(GetAgentByID(-2), 'Y')
  79.         $load_status = GetMapLoading()
  80.  
  81.        
  82.         $moving = GetIsMoving(-2)
  83.  
  84.        
  85.         $cur_dist = ComputeDistance($cur_coordsx, $cur_coordsy, $coords_x, $coords_y)
  86.  
  87.        
  88.         $move_time = round(TimerDiff($move_timer)/1000)
  89.  
  90.  
  91.        
  92.         if $moving = 0 and $move_time > 1 and $cur_dist > $dist then
  93.             ; increment block counter
  94.             $blocked += 1
  95.  
  96.            
  97.             RndSleep(100)
  98.  
  99.             if $blocked >= 4 and $load_status = 1 then
  100.                 $complete = false
  101.                 exitloop
  102.             else
  103.                
  104.                 $new_coords_x = DllStructGetData(GetAgentByID(-2), 'X') + rndNum(200)
  105.                 $new_coords_y = DllStructGetData(GetAgentByID(-2), 'Y') + rndNum(200)
  106.  
  107.                
  108.                 MoveTo($new_coords_x, $new_coords_y)
  109.                 rndSlp(250, 500, false)
  110.  
  111.            
  112.                 MoveTo($coords_x, $coords_y)
  113.             endif
  114.         endif
  115.     until $cur_dist <= $dist or $move_time >= 60
  116.  
  117.     return $complete
  118. endfunc
  119.  
  120. Func WaitForLoad($mapID)
  121.     Do
  122.         RndSleep(250)
  123.         $newID = GetMapID()
  124.         $loadStatus = GetMapLoading()
  125.         $coordsx = DllStructGetData(GetAgentByID(-2), 'X')
  126.         $coordsy = DllStructGetData(GetAgentByID(-2), 'Y')
  127.     Until $newID = $mapID AND $coordsx <> 0 AND $coordsy <> 0
  128.  
  129.     RndSleep(5000)
  130. EndFunc
  131.  
  132.  
  133. Func RndSleep($x)
  134.     Sleep(Random($x * 0.97, $x * 1.03, 1))
  135. EndFunc
  136.  
  137. func rndSlp($min, $max, $ping=true)
  138.     sleep(random($min, $max))
  139.  
  140.     if $ping then
  141.         $ping = GetPing()
  142.         if $ping > 300 then sleep($ping)
  143.     endif
  144. endfunc
  145.  
  146. func rndNum($val)
  147.     $num = random(-$val, $val, 1);====================================here i added the 1 (for int)
  148.     if $num = 0 then
  149.         $num = 1
  150.     endif
  151.     return $num
  152. endfunc
  153.  
  154. Func LOADOUT()
  155.     Do
  156.         Sleep(400)
  157.         $load = GetMapLoading()
  158.     Until $load = 1
  159.     Sleep($TLOAD)
  160. EndFunc
  161. Func LOADIN()
  162.     Do
  163.         Sleep(400)
  164.         $load = GetMapLoading()
  165.     Until $load = 0
  166.     Sleep($TLOAD)
  167. EndFunc
  168. Func abandon()
  169.     $stuck = TimerInit ()
  170.      Resign()
  171.     If  TimerDiff($stuck) > 7000 Then Resign()
  172.     Do
  173.         Sleep(500)
  174.         $dead = GetIsDead(-2)
  175.     Until $dead = 0 Or TimerDiff($stuck) > 7000
  176.     Do
  177.         Sleep(1000)
  178.         ReturnToOutpost()
  179.         Sleep(1000)
  180.         $load = GetMapLoading()
  181.     Until $load = 0 Or TimerDiff($stuck) > 15000
  182. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement