Advertisement
Guest User

Maplestory Ghost Ship Leech QUickMacro

a guest
May 10th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Ensure you have switched Mini Map to the one with both Map Name and Mini Map
  2.  
  3.  
  4. 'Const definitions
  5.  
  6. Const HP_BAR_LEFT_X = 224
  7. Const MP_BAR_LEFT_X = 332
  8. Const HP_MP_TEST_POINT_Y = 615
  9. Const HP_MP_TEST_EMPTY_COLOR = "BEBEBE"
  10.  
  11. Const MINIMAP_TOP_LEFT_X = 24
  12. Const MINIMAP_TOP_LEFT_Y = 118
  13. Const MINIMAP_BOTTOM_RIGHT_X = 119
  14. Const MINIMAP_BOTTOM_RIGHT_Y = 145
  15. Const MINIMAP_PLAYER_COLOR = "88FFFF"
  16. Const MINIMAP_PARTY_COLOR = "0077FF"
  17.  
  18. Const MINIMAP_PLAYER_LEFT_BOUND = 20
  19. Const MINIMAP_PLAYER_RIGHT_BOUND = 110
  20.  
  21. Const FEED_PET_EVERY = 600
  22.  
  23. Const KEY_ATTACK = "G"
  24. Const KEY_BUFF = "Shift"
  25. Const KEY_FEED_PET = "6"
  26. Const KEY_50_Percent_HP = "7"
  27. Const KEY_50_Percent_MP = "8"
  28. Const KEY_75_Percent_HP = "-"
  29. Const KEY_75_Percent_MP = "="
  30.  
  31. Function PressFor(key, d)
  32.     KeyDown key, 1
  33.     Delay d
  34.     KeyUp key, 1
  35.     Delay 30
  36. End Function
  37.  
  38. Function Attack()
  39.     PressFor KEY_ATTACK, 100
  40. End Function
  41.  
  42. Function Move(towards)
  43.     PressFor towards, 900
  44. End Function
  45.  
  46. Function FindPlayer()
  47.     FindColor _
  48.         MINIMAP_TOP_LEFT_X, _
  49.         MINIMAP_TOP_LEFT_Y, _
  50.         MINIMAP_BOTTOM_RIGHT_X, _
  51.         MINIMAP_BOTTOM_RIGHT_Y, _
  52.         MINIMAP_PLAYER_COLOR, _
  53.         playerX, _
  54.         playerY
  55. End Function
  56.  
  57. Function FindParty()
  58.     FindColor _
  59.         MINIMAP_TOP_LEFT_X, _
  60.         MINIMAP_TOP_LEFT_Y, _
  61.         MINIMAP_BOTTOM_RIGHT_X, _
  62.         MINIMAP_BOTTOM_RIGHT_Y, _
  63.         MINIMAP_PARTY_COLOR, _
  64.         partyX, _
  65.         partyY
  66. End Function
  67.  
  68. Function FeedPet()
  69.     If feedTime = Empty Or DateDiff("s", Now, feedTime) > FEED_PET_EVERY Then
  70.         KeyPress KEY_FEED_PET, 1
  71.         feedTime = Now
  72.     End If
  73. End Function
  74.  
  75. Function IsPartyClose()
  76.     xOffset = Abs(partyX - playerX)
  77.     yOffset = Abs(partyY - playerY)
  78.  
  79.     IsPartyClose = xOffset < 5 And yOffset < 5
  80. End Function
  81.  
  82. Function IsHPBelowPercent(percent)
  83.     IfColor HP_BAR_LEFT_X + percent, HP_MP_TEST_POINT_Y, HP_MP_TEST_EMPTY_COLOR, 2 Then
  84.         IsHPBelowPercent = True
  85.     Else
  86.         IsHPBelowPercent = False
  87.     End If
  88. End Function
  89.  
  90. Function IsMPBelowPercent(percent)
  91.     IfColor MP_BAR_LEFT_X + percent, HP_MP_TEST_POINT_Y, HP_MP_TEST_EMPTY_COLOR, 2 Then
  92.         IsMPBelowPercent = True
  93.     Else
  94.         IsMPBelowPercent = False
  95.     End If
  96. End Function
  97.  
  98. Function EnsureHealth()
  99.     If IsHPBelowPercent(30) Then
  100.         PressFor KEY_75_Percent_HP, 99
  101.     ElseIf IsHPBelowPercent(55) Then
  102.         PressFor KEY_50_Percent_HP, 99
  103.     End If
  104.    
  105.     If IsMPBelowPercent(30) Then
  106.         PressFor KEY_75_Percent_MP, 99
  107.     ElseIf IsMPBelowPercent(55) Then
  108.         PressFor KEY_50_Percent_MP, 99
  109.     End If
  110. End Function
  111.  
  112. Function BuffParty
  113.     If IsPartyClose Then
  114.         PressFor KEY_BUFF, 200
  115.     End If
  116. End Function
  117.  
  118. Sub CheckDirection
  119.     If playerX < MINIMAP_PLAYER_LEFT_BOUND Then
  120.         'Move Right
  121.         direction = "Right"
  122.     ElseIf playerX > MINIMAP_PLAYER_RIGHT_BOUND Then
  123.         'Move Left
  124.         direction = "Left"
  125.     End If
  126. End Sub
  127.  
  128. 'Initial Direction
  129. Dim direction : direction = "Right"
  130. Dim playerX
  131. Dim playerY
  132. Dim partyX
  133. Dim partyY
  134. Dim feedTime : feedTime = Empty
  135.  
  136. Do While True
  137.     EnsureHealth
  138.     'FeedPet
  139.      
  140.     FindPlayer
  141.     'FindParty
  142.  
  143.     'BuffParty
  144.     CheckDirection
  145.     Attack
  146.     Move direction
  147. Loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement