Moderator: MacroQuest Developers


Code: Select all
/varset ItemsHave ${FindItemCount[=${Cursor.Name}]}Code: Select all
/varset ItemsHave ${FindItem=${Cursor.Name}} 
Running into the same problem. I'm using the original macro posted at the top of thread. The macro is not automatically foraging. When I hit my hotkey for forage and find something, it will auto inventory the item but will not automatically forage. Suggestions?idoit2 wrote:im sure im doing something wrong but i looked couldnt figure it out when i try to stay the mac it says you no longer have a target. the current macro has ended. if anyone could help me id appreciate it!

Code: Select all
|04/20/05
|yafm.mac
|
|Yet Another Forage Macro
|
|Ini File: yafm.ini
|
| 0 = destroy
| x = keep at most x of this item
|
|New foraged items are added to the ini file automatically and are kept by default.
|04/20/05: You should return to sitting or fighting as applicable.
|04/24/05 Will stop the macro automatically if you camp
| -- was causing an issue spamming your MQ window at character select screen.
|04/25/05 Added a check to see if you are at the bank, casting a spell,
| or have your spellbook open so you won't get spammed.
#event Success "You have scrounged #*#"
#event Camp "It will take about #*#"
||||||||||||||||||||
| Main
||||||||||||||||||||
sub Main
/declare DefaultMaxSave int outer
/varset DefaultMaxSave ${Ini[yafm.ini,Default,MaxSave,${NotFound}]}
/if (${DefaultMaxSave}==${NotFound}) {
/ini "yafm.ini" "Default" "MaxSave" "100"
/varset DefaultMaxSave 100
}
| Verify that we have the ability to forage.
/if (${Me.Skill[Forage]}==0) {
/echo You cannot forage, silly person!
/goto :Exit
}
:Forage
| If we can forage then prepare to do so and return to previous state--
| sitting or attacking so far. Am I missing anything?
/if (${Me.AbilityReady[Forage]}) {
/if ( ${Window[BigBankWnd].Open}) {
/goto :Forage
}
/if ( ${Window[SpellBookWnd].Open}) {
/goto :Forage
}
/if ( ${Me.Casting.ID}) {
/goto :Forage
}
/if (${Me.State.NotEqual[STAND]}) {
/stand
/delay 1s
/doability forage
/sit
} else /if (${Me.Combat}) {
/attack off
/delay 1s
/doability forage
/attack on
} else {
/delay 1s
/doability forage
}
}
/doevents
/goto :Forage
:Exit
/return
||||||||||||||||||||
| Success
||||||||||||||||||||
sub Event_Success
| If we successfully foraged something then take care of it.
/if (${Cursor.ID}) {
/call HandleItem
}
/return
||||||||||||||||||||
| Camp
||||||||||||||||||||
sub Event_Camp
/echo "Camping, macro ended."
/endmacro
/return
||||||||||||||||||||
| HandleItem
||||||||||||||||||||
sub HandleItem
/declare ItemSetting int local
/declare NotFound int local
/declare ItemsHave int local
/varset NotFound -1
:LootIt
| Look up this item in yafm.ini
/varset ItemSetting ${Ini[yafm.ini,ForageList,${Cursor.Name},${NotFound}]}
/delay 5
| If the item isn't in the .ini file then add it.
/if (${ItemSetting}==${NotFound}) {
/ini "yafm.ini" "ForageList" "${Cursor.Name}" "${DefaultMaxSave}"
/varset ItemSetting ${DefaultMaxSave}
}
/varset ItemsHave ${FindItemCount[=${Cursor.Name}]}
| If we're keeping this item then stash it in our bags.
| Otherwise, just destroy it.
/if (${ItemSetting}>${ItemsHave}) {
/autoinventory
} else {
/destroy
}
/delay 5
/if (${Cursor.ID}) /goto :LootIt
/return