- Joined
- Oct 17, 2006
- Messages
- 176
- Reaction score
- 0
- Points
- 0
Hello there, been a while since i played with macros, and i have been testing an old assist with loot macro:
Usually it would filter based on HunterLoot, but actually hes just hitting loot all and keep going. Maybe i am too sleepy to see whats wrong, can anyone gimme a light about what i am missing here, please?
Code:
|Simple Assist Macro v2.0
|Ripped from Various Macro's
|By HardOne
|
#event ImDead "#*#You have been slain by#*#"
#event ImDead "Returning to home point, please wait..."
#event ImDead "#*#Returning to Bind Location#*#"
#Event BadCorpse "You may not loot#*#"
#Event BadCorpse "Someone #*# already looting#*#"
#Event BadCorpse "You are too far away to loot that corpse."
#Event BadCorpsee "#*# Lore Item#*#"
#Event BadCorpse "There are no spawns matching: (0-100)#*#"
Sub Main
|SYSTEM VARS - DO NOT MODIFY.
/declare maintank string outer ${Param0}
/declare attackat int outer ${Param1}
/declare attackid int outer
/declare RT_MyXLOC int outer ${Me.X}
/declare RT_MyyLOC int outer ${Me.Y}
/declare MyHeading int outer ${Me.Heading.DegreesCCW}
/declare Camp_Zone int outer ${Zone.ID}
/declare RV_DisplayStats int outer 1
/declare loopcount int outer
/declare itemcount int outer
/declare itemsleft int outer
/declare Unlootable int outer
/declare RV_LootSlot int outer 0
/lootnodrop never
/squelch /alert clear 2
|------------------------------------------------------------
|Loot Array Information.
|------------------------------------------------------------
/call ReadINI HunterLoot.ini "${Zone.Name}" Loot
/if (!${Defined[RV_LootArray]}) {
/echo No Loot Array Created...
}
/if (!${Param0.Length} && !${Param1.Length}) {
/echo You must start the macro including the main assist's name and the percent to attack after.
/echo i.e.:
/echo /mac assist Ubertank 90
/end
}
/echo AFK AssistTank Running. Assisting ${Param0} at ${Param1}%
/echo Camp Set to: ${Me.X} ${Me.Y}, Facing: ${Me.Heading.DegreesCCW} in ${Zone}
/echo Ensuring MQ2Melee is loaded
/plugin mq2melee
/delay 2s
/squelch /target clear
/squelch /assist off
:mainloop
/call GMCheck
/if (!${SpawnCount[${maintank}]}) {
/echo Maintank Dead/Missing. Delaying 30 seconds and restarting.
/delay 30s
/goto :mainloop
}
/assist ${maintank}
/delay 10
/if (${Target.ID} && ${Target.Type.Equal[NPC]} && ${Target.PctHPs}<${attackat} && ${Target.Distance.Int} <= 40) /call Attacking
/if (${Target.ID} && ${Target.Type.Equal[pet]} && ${Target.PctHPs}<${attackat} && ${Target.Distance.Int} <= 40) /call Attacking
/doevents
/goto :mainloop
/end
Sub Attacking
/pet attack
/echo Attacking ${Target.CleanName}!
/varset attackid ${Target.ID}
:attackloop
/call GMCheck
/if (!${Target.ID}) /goto :endcombat
/if (${Target.ID}!=${attackid}) /goto :newtarget
/if (!${Me.Combat}) /attack on
/doevents
/goto :attackloop
:newtarget
/echo Somehow got new target. Re-assisting maintank.
:endcombat
/varset attackid 0
/delay 2s
/varset Unlootable 0
/call Lootaa
/if (${Camp_Zone} == ${Zone.ID}) /call MoveToLoc ${RT_MyyLOC} ${RT_MyXLOC}
/face fast heading ${MyHeading}
/return
Sub MoveToLoc(MoveToY, MoveToX)
/declare running int local
/declare distanceNow float local
/declare distanceBefore float local
/declare distanceModifier int local
/declare distanceTimer timer 15
/varset running 0
/varset distanceBefore ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
/varset distanceModifier 1
/echo Moving to Location: ${MoveToY}, ${MoveToX}.
/echo Distance: ${distanceBefore}
:moveToLocation
/face fast nolook loc ${MoveToY},${MoveToX}
/if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}<10) {
/keypress forward
/return
}
/if (${distanceTimer}==0) {
/if (${Me.Sneaking}) {
/varset distanceModifier 2
} else {
/varset distanceModifier 1
}
/varset distanceNow ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
/if (${Math.Calc[${distanceBefore}-${distanceNow}]}<${Math.Calc[10/${distanceModifier}]}) {
/call HitObstacle
}
/varset distanceBefore ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
/varset distanceTimer 15
}
/if (${running}==0) {
/keypress forward
/if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}>10) {
/varset running 1
/keypress forward hold
}
} else {
/if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}<11) {
/varset running 0
/keypress forward
}
}
/goto :moveToLocation
/return
Sub HitObstacle
/echo Obstacle hit, moving around it...
/keypress forward
/keypress back hold
/delay 3
/keypress back
/if (${Math.Rand[2]}) {
/keypress strafe_right hold
} else {
/keypress strafe_left hold
}
/delay 5
/keypress strafe_right
/keypress strafe_left
/keypress forward hold
/return
Sub Event_ImDead
/doevents
/if (${Stick.Status.Equal[ON]}) /squelch /stick off
/keypress forward
/keypress back
/keypress Left
/keypress Right
/delay 2s
/echo I've been Killed! Going into Sleep Mode...
:DeathSleep
/doevents
/delay 5s
/if (${Me.State.Equal[HOVER]} || ${Zone.ID} != ${Camp_Zone}) /goto :DeathSleep
/return
|--------------------------------------------------------------------------------
|SUB: Reading from an INI File
|--------------------------------------------------------------------------------
Sub ReadINI(FileName,SectionName,ArrayType)
/echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}...
/delay 1s
/if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) {
/echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro...
/delay 1s
/return
}
/declare nValues int local 1
/declare nArray int local 0
/declare KeySet string local ${Ini[${FileName},${SectionName}]}
:CounterLoop
/if (!${KeySet.Arg[${nValues},|].Length}) {
/varcalc nValues ${nValues}-1
/goto :MakeArray
}
/varcalc nValues ${nValues}+1
/goto :CounterLoop
:MakeArray
/if (!${nValues}) /return
/if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) {
/echo Declaring Loot Array...
/declare RV_LootArray[${nValues}] string outer
/declare RV_LootStats[${nValues}] string outer
}
/for nArray 1 to ${nValues}
/if (${FileName.Equal["HunterLoot.ini"]}) {
/varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]}
/varset RV_LootStats[${nArray}] 0
}
/next nArray
/echo "${SectionName}" Zone Information Read Successfully from ${FileName}...
/delay 1s
/return
|--------------------------------------------------------------------------------
|SUB: Looting
|--------------------------------------------------------------------------------
Sub Lootaa
:Loopa
/if (${Spawn[corpse noalert 2].ID}) {
/tar corpse radius 100 noalert 2
/squelch /alert add 2 id ${Target.ID}
/call Loota
/varset Unlootable 0
/squelch /return
}
/if (${Spawn[corpse noalert 2].ID}) /goto :Loopa
/return
Sub Loota
:CorpseGoneCheck
/stick 10
/delay 2s
/doevents
/loot
/if (${Unlootable}==1) /return
/if (!${Target.ID}) /goto :CorpseGoneCheck
/delay 2s
/delay 10
:WaitForOpen
/if (!${Target.ID}) /return
/doevents
/if (${Unlootable}==1) /return
/if (!${Window[LootWnd].Open}) /goto :WaitForOpen
/delay ${lootdelay}
/if (${Corpse.Items}==0) /goto :Itemcount
:Itemcount
/notify LootWnd LW_LootAllButton leftmouseup
/delay 2s
/notify LootWnd DoneButton leftmouseup
/call MoveToLoc ${RT_MyyLOC} ${RT_MyXLOC}
/return
|--------------------------------------------------------------------------------
|SUB: Display Stats
|--------------------------------------------------------------------------------
Sub DisplayStats
/declare nArray int local
/if (${Defined[RV_LootArray]}) {
/for nArray 0 to ${RV_LootArray.Size}
/echo ${Int[${RV_LootStats[${nArray}]}]} ${RV_LootArray[${nArray}]}'s
/next nArray
}
/return
Sub Event_BadCorpse
/squelch /alert clear 2
/varset Unlootable 1
/return
Sub Event_BadCorpsee
:NoLoot
/if (${Cursor.ID}) /goto :LootItem
/notify LootWnd DoneButton leftmouseup
:WaitForClose
/if (${Window[LootWnd].Open}) /goto :WaitForClose
/return
|--------------------------------------------------------------------------------
|SUB: GM Check
|--------------------------------------------------------------------------------
Sub GMCheck
/if (${Spawn[gm].ID}) {
/beep
/beep
/beep
/delay 300s
/ECHO FUCK GM
/endm
/call GMCheck
}
/return
Usually it would filter based on HunterLoot, but actually hes just hitting loot all and keep going. Maybe i am too sleepy to see whats wrong, can anyone gimme a light about what i am missing here, please?