I kept getting stuck in a shrubbery. (Blightfire Moors, 1633.04 -1766.91 75.59 Facing NW, for an example of one time I got stuck.) It happened a lot. The nav command couldn't find me in the mesh, so I needed a way to twitch myself out. I hacked in a jitter command to the farm macro to resolve this. Since this was the first time I messed with a macro, I also added a bunch of new debug commands to help me track down where things were breaking. In case anyone else has the same problem, here's my diff from the default macro.
[CODE lang="ini" title="Diff with Jitter and Debugs"]--- Farm.mac Fri Feb 5 18:15:01 2021
+++ MalletFarm.mac Fri Feb 5 18:11:41 2021
@@ -110,16 +110,21 @@
/declare i int local 0
/declare j int local 1
/if (${MobsInRange}) {
+ /if (${Debugging}) /echo I found ${MobsInRange} mobs. Let's try to get one. Macroline: ${Macro.CurLine}
/if (${MobsInRange} > 100) {
- /if (${Debugging}) /echo There were more than 100 mobs in range, cutting down the list.
+ /if (${Debugging}) /echo There were more than 100 mobs in range, cutting down the list. Macroline: ${Macro.CurLine}
/varset MobsInRange 100
}
- |** PullList[#,1] = ID of mob, PullList[#,2] = PathLength **|
+ |** PullList[#,1] = ID of mob, PullList[#,2] = PathLength **|
/declare PullList[${MobsInRange},2] int local 0
/for i 1 to ${MobsInRange}
+ /if (${Debugging}) {
+ /echo \at${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].Name} was not a valid pull target.
+ /echo \ar${Navigation.PathExists[id ${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].ID}]} && ${Int[${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].Distance3D}]} <= ${Int[${Navigation.PathLength[id ${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].ID}]}]}
+ }
/if (${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].Name.NotEqual[NULL]} && !${Ini[${MobIgnore},${Zone.ShortName},Ignored].Find[${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].CleanName}|]}) {
/if (${Navigation.PathExists[id ${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].ID}]} && ${Int[${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].Distance3D}]} <= ${Int[${Navigation.PathLength[id ${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].ID}]}]}) {
- /if (${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].PctHPs} == 100) {
+ /if (${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].PctHPs} >= 100) {
/varset PullList[${j},1] ${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].ID}
/varset PullList[${j},2] ${Int[${Navigation.PathLength[id ${NearestSpawn[${i},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].ID}]}]}
/if (${j}==1) {
@@ -140,15 +145,28 @@
}
/next i
/if (${PullTargetID}) {
+ /if (${Debugging}) /echo Found a pull target: ${PullTargetID} Macroline: ${Macro.CurLine}
/varset myTargetID ${PullTargetID}
/setchattitle Going to kill ${Spawn[id ${myTargetID}].CleanName}!
+ } else /if (${Jitter}) {
+ | Add to jitter toon if there is no path to anything. You're probably in a plant. Could add /circle, but this seems sufficient.
+ /if (${Debugging}) /echo You found mobs but can't get to anything. Jittering your toon to unstick them. Macroline: ${Macro.CurLine}
+ /target id ${NearestSpawn[${Math.Rand[${MobsInRange}]},npc noalert 1 targetable radius ${PullRange} zradius ${ZRadius} "${FarmMob}"].ID}
+ /face fast
+ /delay 1s
}
} else /if (${Me.Standing}) {
/if (!${Me.Casting.ID} && !${SitDelay} && !${Me.Moving} && !${Me.Mount.ID}) {
/sit
/varset SitDelay ${SitDelay.OriginalValue}
}
- }
+ } else {
+ | Added a no-mob delay. Here's hoping "delay" uses an interupt and isn't some sort of for-loop spinner.
+ /if (${Debugging}) /echo I found ${MobsInRange} mobs. Waiting 2s. Macroline: ${Macro.CurLine}
+ /delay 2s
+ }
+
+
} else /if (!${Me.XTarget[1].Type.Equal[Corpse]}) {
/varset myTargetID ${Me.XTarget[1].ID}
}
@@ -458,10 +476,10 @@
/return
Sub WaitNav(NavTargetID, distance)
- /if (${Debugging} && ${distance}) /echo Distance from mob nav target to stop: ${distance}
+ /if (${Debugging} && ${distance}) /echo Distance from mob nav target ${NavTargetID} to stop: ${distance}
:keepGoing
/call BindCheck
- /if (${Debugging}) /echo NavTest Variables: [SpawnHasID]${Spawn[id ${NavTargetID}].ID} [Distance from mob]${Spawn[id ${NavTargetID}].Distance} > [Distance To Stop]${If[${distance},${distance},20]} || [Line Of Sight]!${Spawn[id ${NavTargetID}].LineOfSight}
+ /if (${Debugging}) /echo NavTest Variables: [SpawnHasID]${Spawn[id ${NavTargetID}].ID} AND [Distance from mob]${Spawn[id ${NavTargetID}].Distance} > [Distance To Stop]${If[${distance},${distance},20]} || [Line Of Sight]!${Spawn[id ${NavTargetID}].LineOfSight}
/if (${Spawn[id ${NavTargetID}].ID} && (${Spawn[id ${NavTargetID}].Distance} > ${If[${distance},${distance},20]} || !${Spawn[id ${NavTargetID}].LineOfSight})) {
/if (${Navigation.Active}) {
/if (${Me.XTarget[1].ID}) {
@@ -563,17 +581,20 @@
Sub FarmStuff(string Enemy)
/if (${Bool[${Enemy}]}) {
+ /if (${Debugging}) /echo Set Farmmob to ${Enemy} Macroline: ${Macro.CurLine}
/varset FarmMob "${Enemy}"
/if (${Debugging} && !${reportTarget}) {
/echo Looking for: ${FarmMob}
/varset reportTarget ${reportTarget.OriginalValue}
}
} else /if (!${reportTarget}) {
- /squelch /echo Attacking anything I can get my grubby paws on.
+ /echo Attacking anything I can get my grubby paws on.
/varset reportTarget ${reportTarget.OriginalValue}
}
:findMob
+
/if (${Target.Type.Equal[corpse]}) {
+ /if (${Debugging}) /echo You are targetting a corpse: ${Target.ID} (You: ${myTargetID} ) Macroline: ${Macro.CurLine}
/if (${Target.ID} == ${myTargetID}) /varset myTargetID 0
/squelch /target clear
}
@@ -584,21 +605,21 @@
/call GroupEndChk
/call GroupManaChk
}
- |/if (${Debugging}) /echo \aymyTargetID has an ID: ${Spawn[id ${myTargetID}].ID} - is a corpse: ${Spawn[id ${myTargetID}].Type.Equal[Corpse]} - I have an XTarget: !${Me.XTarget[1].ID}
+ /if (${Debugging}) /echo myTargetID has an ID: ${Spawn[id ${myTargetID}].ID} - IsCorpse: ${Spawn[id ${myTargetID}].Type.Equal[Corpse]} - HaveXTarget: ${Me.XTarget[1].ID} Macroline: ${Macro.CurLine}
/if (!${Spawn[id ${myTargetID}].ID} || ${Spawn[id ${myTargetID}].Type.Equal[Corpse]} && !${Me.XTarget[1].ID}) {
/varset myTargetID 0
/call TargetShortest
- /if (${Debugging} && ${myTargetID} && ${Spawn[id ${myTargetID}].Type.NotEqual[corpse]}) /echo Target is ${Spawn[id ${myTargetID}]}
+ /if (${Debugging}) /echo Target is ${Spawn[id ${myTargetID}]} ( ${myTargetID} ) Macroline: ${Macro.CurLine}
} else {
- /if (${Debugging}) /echo \ayI have an XTarget so I'm going to set that as my target.
+ /if (${Debugging}) /echo I have an XTarget ( ${Me.XTarget[1].ID} ) so I'm going to set that as my target. Macroline: ${Macro.CurLine}
/varset myTargetID ${Me.XTarget[1].ID}
/call Combat
}
:navto
- |/if (${Debugging}) /echo ${Spawn[${myTargetID}].Distance} > ${If[${PullAbilityRange},${PullAbilityRange},1]} && !${Me.XTarget[1].ID} ${If[${PullRequiresLineOfSight}, || !${Spawn[${myTargetID}].LineOfSight},]}
+ /if (${Debugging}) /echo ${Spawn[${myTargetID}].Distance} > ${If[${PullAbilityRange},${PullAbilityRange},1]} && !${Me.XTarget[1].ID} ${If[${PullRequiresLineOfSight}, || !${Spawn[${myTargetID}].LineOfSight},]}
/if (${Spawn[${myTargetID}].Distance} > ${If[${PullAbilityRange},${PullAbilityRange},1]} && !${Me.XTarget[1].ID} ${If[${PullRequiresLineOfSight}, || !${Spawn[id ${myTargetID}].LineOfSight},]}) {
/if (!${Bool[${Spawn[${myTargetID}].ID}]}) {
- |/if (${Debugging}) /echo \ar My target ID was null, so I'm returning out of the sub.
+ /if (${Debugging}) /echo \ar My target ID was null, so I'm returning out of the sub.
/varset myTargetID 0
/return
}
@@ -622,11 +643,13 @@
/call PullAbility
} else {
/call WaitNav ${myTargetID} 20
+ /if (${Debugging}) /echo I have an XTarget ( ${myTargetID} ) so I'm going to set that as my target. Macroline: ${Macro.CurLine}
/call Combat
}
/return
Sub Combat
+ /if (${Debugging}) /echo Entering Combat Subroutine
/if (${Target.ID} && (${Target.Type.Equal[npc]} || ${Target.Type.Equal[pet]})) {
/if (${Navigation.Active}) /squelch /nav stop
/if (!${Me.Class.PureCaster}) /stick uw loose moveback behind 8
@@ -776,6 +799,7 @@
/squelch /target id ${Me.XTarget[1].ID}
/delay 2s ${Target.ID}==${Me.XTarget[1].ID}
/if (${Target.ID} != ${myTargetID}) /varset myTargetID ${Target.ID}
+ /if (${Debugging}) /echo Pull to combat Macroline: ${Macro.CurLine}
/call Combat
} else /if (${Spawn[id ${myTargetID}].Type.NotEqual[Corpse]} && ${Spawn[id ${myTargetID}].ID}) {
|/if (${Debugging}) /echo \aymyTargetID not a corpse: ${Spawn[id ${myTargetID}].Type.NotEqual[Corpse]} - Has an ID: ${Spawn[id ${myTargetID}].ID} == ${myTargetID}
@@ -1521,6 +1545,46 @@
/echo \aoPullRequiresLineOfSight is now\aw: \arOFF!
} else {
/echo \arError\aw: \ap${Param1} \aris not a valid option for /farm LineOfSight
+ }
+ }
+ }
+ |If /farm Jitter
+ } else /if (${Param0.Equal[Jitter]}) {
+ /if (!${Defined[Param1]}) {
+ /echo \Jitter\aw: \ag${Jitter}\aw.
+ } else {
+ /call IsNumber "${Param1}"
+ /if (${Macro.Return.Equal[TRUE]}) {
+ /if (${Param1}==1) {
+ /if (!${Jitter}) {
+ /varset Jitter TRUE
+ /call IniChange "General" "Jitter" "TRUE"
+ /echo \aoJitter is now\aw: \agON\aw!
+ } else {
+ /echo \arJitter is already on.
+ }
+ } else /if (${Param1} == 0) {
+ /if (${Jitter}) {
+ /varset Jitter FALSE
+ /call IniChange "General" "Jitter" "FALSE"
+ /echo \aoJitter is now\aw: \arOFF\aw!
+ } else {
+ /echo \arJitter is already off.
+ }
+ } else {
+ /echo \arError\aw: \ap${Param1} \aris not a valid option for /farm Jitter
+ }
+ } else {
+ /if (${Param1.Equal[on]}) {
+ /varset Jitter TRUE
+ /call IniChange "General" "Jitter" "TRUE"
+ /echo \aoJitter is now\aw: \agON\aw!
+ } else /if (${Param1.Equal[off]}) {
+ /varset Jitter FALSE
+ /call IniChange "General" "Jitter" "FALSE"
+ /echo \aoJitter is now\aw: \arOFF\aw!
+ } else {
+ /echo \arError\aw: \ap${Param1} \aris not a valid option for /farm Jitter
}
}
}
@@ -1644,6 +1708,7 @@
/call CheckINI ${Settings} Mana MedAt int 30
/call CheckINI ${Settings} Mana MedTill int 100
/call CheckINI ${Settings} General CastDetrimental bool TRUE
+ /call CheckINI ${Settings} General Jitter bool FALSE
/call GetRangedInfo
/call GetPullAbilityCommand
/return
[/CODE]