*If you were sitting at the time of forage, this will stand you to do the foraging and then sit you down again.
*If you were attacking at the time of forage, this will stop attack, forage and then resume attack.
*This allows you (like yafm.mac) to set how many of an item you want to keep, 0 destroys the item, 10 is the default save, 20 will save 20, 30 will save 30, etc. Simply set the value in forageaa.ini.
*If an item is not found in the .ini, it will automatically be added (like yafm.mac and mq2autoforage).
*If there is no .ini, it will automatically be created.
*This prints out a short synopsis of your forage deeds. Tells you how many forages you've done, how many times you've got food/water, how many inedibles, how many fishing grubs, and how many fails.
*Does a simple popup message if you get a Double Forage thanks to the Nature's Bounty AA.
*This also tells you how many of that particular item you currently have in inventory already.
*WARNING!!!! - DO NOT SET DefaultSave to 0!!! You might accidentally destroy something in your inventory or gear with this setting!!!!! You have been warned!!!!
So, after all that, here it is:
Code: Select all
| 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 failed 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
/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
|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
}
/doevents
|If we foraged something, deal with it
/if (${Cursor.ID}) {
/call HandleItem
}
|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
}
/call ForageStats
/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}
/echo --------------------------------------------------------------------
/echo * Total Forages: ${iForage}
/echo * Food/Water : ${iSust}
/echo * Inedibles : ${iStuff}
/echo * Grubs, Fails : ${iBads}
/echo * Skillups : ${iSkill}
/echo * Double Forage: ${iBounty}
/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]}
/echo iSkill ${iSkill}+1
/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




