|-- Move.Mac
|-- Sets an anchor and moves you to the corpses, loots, and moves back to anchor point. Set to loot corpses in 400 radius.
#Event zone "#*#You have entered #*#"
Sub main
/declare MyXLOCA int outer 0
/declare MyYLOCA int outer 0
/declare BreakLoop int outer 0
/declare AnchorX int outer ${Me.X}
/declare AnchorY int outer ${Me.Y}
/declare LootSlot int outer 0
/declare LootCheck int outer 0
/declare LootTotal int outer 0
/declare locv1 int outer 0
/declare xDistance int outer 0
:Loopa
/call Loot
/call CheckAnchor
/delay 1m
/goto :Loopa
/endmacro
Sub Loot
:LtLoop
/varcalc locv1 ${locv1}+1
/target corpse radius 400
/if (!${Target.ID} || ${Target.Type.NotEqual[Corpse]}) /return
/varset xDistance 5
/call GotoBody ${Target.ID}
/if (${Target.ID}) /face nolook fast
/loot
/delay 40 ${Window[LootWnd].Open}
/if (!${Corpse.Items}) {
/goto :ExitSWLt
}
/varset LootTotal ${Corpse.Items}
/for LootSlot 1 to ${LootTotal}
/itemnotify loot${LootSlot} rightmouseup
/delay 10 ${Cursor.ID}
/notify InventoryWindow IW_CharacterView rightmouseup
/delay 10
:NextSWLt
/next LootSlot
:ExitSWLt
/cleanup
/delay 10
/if (${locv1}<4) /goto :LtLoop
/return
Sub GotoBody(BodyID)
/varset BreakLoop 0
/if (${Me.Mount.ID}) {
/dismount
/delay 10
}
/if (${Me.Sitting}) /stand
/if (${Target.ID}!=${BodyID}) {
/keypress clear_target
/delay 3
/target id ${BodyID}
/delay 3
}
:KeepGoingBody
/doevents
/delay 0
/if (${BreakLoop}==1) /return
/if (${Target.Distance}>=10) {
/face nolook fast
/keypress forward hold
}
/if (${Target.Distance}<10) {
/varset BreakLoop 1
/keypress forward
/return
}
/call CheckObstacle
/if (${BreakLoop}!=1) /goto :KeepGoingBody
/return
|# Checks to see if we may have bumped into something that is stopping us
sub CheckObstacle
|# Record our current position, wait a moment and then check if its the same
/varset MyXLOCA ${Me.X}
/varset MyYLOCA ${Me.Y}
/delay 2
/if (${MyXLOCA}==${Me.X} && ${MyYLOCA}==${Me.Y}) /call Obstacle
/return
|# Uses strafe and randomness to try and get around things
sub Obstacle
/keypress forward
/keypress back hold
/delay 5
/keypress back
/if (${Math.Rand[2]}) {
/keypress strafe_right hold
/delay 3
/keypress strafe_right
} else {
/keypress strafe_left hold
/delay 3
/keypress strafe_left
}
/keypress forward hold
/return
Sub CheckAnchor
/if (${Math.Distance[${AnchorY},${AnchorX}]}>12) /call MoveToAnchor
/return
Sub MoveToAnchor
/declare iCount int local
/varset iCount 0
/echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}.
:AnchorMoveLoop
/delay 1
/doevents
/face nolook loc ${AnchorY},${AnchorX}
/if (${Math.Distance[${AnchorY},${AnchorX}]}>12) {
/keypress forward hold
} else {
/keypress forward
/face away loc ${AnchorY},${AnchorX}
/return
}
/if (${iCount}>2) {
/call Detectobst
/face nolook loc ${AnchorY},${AnchorX}
/varset iCount 0
}
/varcalc iCount ${iCount}+1
/goto :AnchorMoveLoop
/return
Sub Detectobst
/return
/endmacro
Sub Event_zone
/echo ZONE! Ending macro!
/endmacro
/return