| ForageAA.mac
|
| This macro is adapted from yafm and mq2autoforage plugin
| since neither of those plugins takes into account if you
| have Nature's Bounty AA's and manage to forage more than
| one item. This also prints out a little chart giving you
| forage statistics. I liked the /echo functionality of
| mq2autoforage, and the ability of yafm.mac to say how
| many items you want to keep. So, I combined the two into
| one.
|
|
| *WARNING* - DO NOT SET DefaultSave to 0. If you accidentally
| click on something in your inventory, you could destroy
| it if MaxSave is set to 0.
|
| Ini File: forageaa.ini
|
| 0 = destroy
| X = keep X of that item
|
|
| New foraged items are kept and added to the ini automatically
|
| yafm.mac author = bootyjuice
| moded = mdar
| moded = Redbot
| moded = bror
#event YouDied "You have been slain by#*#"
#event Bounty "Your forage mastery has enabled you to find something else!"
#event SkillUp "You have become better at Foraging (#*#)"
#event Fail "You fail to locate any food nearby."
#event Food "You have scrounged up some food."
#event Water "You have scrounged up some water."
#event Stuff "You have scrounged up something that doesn't look edible."
#event Grubs "You have scrounged up some fishing grubs."
#event Camp "It will take you about #*# seconds to prepare your camp."
sub main
/declare DefaultSave outer
/declare NotFound int outer -1
/declare iBounty int outer 0
/declare iFail int outer 0
/declare iFood int outer 0
/declare iSkill int outer 0
/declare iWater int outer 0
/declare iGrubs int outer 0
/declare iStuff int outer 0
/declare iAtk int outer 0
/declare iSit int outer 0
/declare StartSkill int outer 0
/declare CurrentSkill int outer 0
/varset StartSkill ${Me.Skill[Forage]}
/varset DefaultSave ${Ini[forageaa.ini,Default,Save,${NotFound}]}
/if (${DefaultSave}==${NotFound}) {
/ini "forageaa.ini" "Default" "Save" "20"
/varset DefaultSave 20
}
/cleanup
|Verify that we are able to forage
/if (${Me.Skill[forage]}==0) {
/echo You cannot forage! Sorry...
/goto :Exit
}
:Forage
/doevents flush
|If we're able to forage, let's get with it.
/if (${Me.AbilityReady[Forage]}) {
|Stand Up if not already
/if (${Me.State.NotEqual[Stand]}) {
/varset iSit 1
/stand
/delay 5
}
|If attack is on, stop attacking
/if (${Me.Combat}==TRUE) {
/echo Stopping Attack to Forage...
/varset iAtk 1
/attack
/delay 5
}
/doability Forage
/delay 1s
/doevents
|If we foraged something, deal with it
/if (${Cursor.ID}) {
/call HandleItem
}
/call ForageStats
}
|If we were sitting, resit
/if (${iSit}==1) {
/delay 1s
/sit
/varset iSit 0
/delay 5
}
|If we were attacking, resume
/if (${iAtk}==1) {
/attack
/varset iAtk 0
/delay 3
}
/goto :Forage
:Exit
/return
sub HandleItem
/declare ItemSetting int local
/declare ItemsHave int local
:LootIt
|Look up the item in forageaa.ini
/varset ItemSetting ${Ini[forageaa.ini,ForageList,${Cursor.Name},${NotFound}]}
/delay 5
|If the item is not on the list, add it
/if (${ItemSetting}==${NotFound}) {
/ini "forageaa.ini" "ForageList" "${Cursor.Name}" "${DefaultSave}"
/echo Item not found, Adding ${Cursor.Name} to forageaa.ini
/varset ItemSetting ${DefaultSave}
}
/varset ItemsHave ${FindItemCount[=${Cursor.Name}]}
|If we're keeping this, put it in Inventory
|Otherwise destroy
/if (${ItemSetting}>${ItemsHave}) {
/echo Keeping: ${Cursor.Name}
/echo Currently Have ${ItemsHave} of ${Cursor.Name}
/autoinventory
} else {
/echo Destroying: ${Cursor.Name}
/destroy
}
/delay 5
/if (${Cursor.ID}) {
/goto :LootIt
}
/return
Sub ForageStats
/declare iForage int local 0
/declare iBads int local 0
/declare iSust int local 0
/varcalc iForage ${iFood}+${iWater}+${iGrubs}+${iStuff}+${iFail}
/varcalc iBads ${iFail}+${iGrubs}
/varcalc iSust ${iWater}+${iFood}
/varcalc iSkill ${StartSkill}-${Me.Skill[Forage]}
/echo --------------------------------------------------------------------
/echo * Total Forages : ${iForage}
/echo * Food/Water : ${iSust}
/echo * Inedibles : ${iStuff}
/echo * Grubs, Fails : ${iBads}
/echo * Skillups : ${iSkill}
/echo * Double Forage : ${iBounty}
/echo * Starting Skill: ${StartSkill}
/echo * Current Skill : ${Me.Skill[Forage]}
/echo --------------------------------------------------------------------
/return
Sub Event_YouDied
/echo You Died at ${Time}, ending macro.
/quit
/end
/return
Sub Event_Bounty
/popup Woot, Double Forage!
/varcalc iBounty ${iBounty}+1
/return
Sub Event_SkillUp
/echo Your Skill has Increased!
/echo Foraging = ${Me.Skill[Forage]}
/return
Sub Event_Water
/varcalc iWater ${iWater}+1
/return
Sub Event_Food
/varcal iFood ${iFood}+1
/return
Sub Event_Stuff
/varcalc iStuff ${iStuff}+1
/return
Sub Event_Fail
/varcalc iFail ${iFail}+1
/return
Sub Event_Grubs
/varcalc iGrubs ${iGrubs}+1
/return
Sub Event_Camp
/endmac
/return