Page 1 of 5
Yet Another Forage Macro - yafm
Posted: Fri Apr 30, 2004 12:19 pm
by bootyjuice
Just another stupid forage macro with .ini file. Nothing special about this forage macro except that it's clean, simple, commented, and I've actually tested it.
Really it's a piece of junk. The only interesting feature is that it supports changes to the .ini file on the fly.
Let me know if anyone has any problems with it.
bootyjuice
Code: Select all
|yafm.mac
|
|Yet Another Forage Macro
|
|Ini File: yafm.ini
|
| 0 = destroy
| 1 = keep
|
|New foraged items are added to the ini file automatically and are kept by default.
||||||||||||||||||||
| Main
||||||||||||||||||||
sub Main
/cleanup
| Verify that we have the ability to forage.
/if (${Me.Skill[Forage]}==0) {
/echo You cannot forage, silly person!
/goto :Exit
}
:Forage
| Stand up. Can't forage while sitting.
/if (${Me.State.NotEqual[STAND]}) {
/stand
/delay 5
}
/delay 1s
| If we can forage then do so.
/if (${Me.AbilityReady[Forage]}) {
/doability forage
}
| If we successfully foraged something then take care of it.
/if (${Cursor.ID}) {
/call HandleItem
}
/goto :Forage
:Exit
/return
||||||||||||||||||||
| HandleItem
||||||||||||||||||||
sub HandleItem
/declare ItemSetting int local
/declare NotFound int local
/varset NotFound -1
| 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}" "1"
/varset ItemSetting 1
}
| If we're keeping this item then stash it in our bags.
| Otherwise, just destroy it.
/if (${ItemSetting}==1) {
:LootIt
/autoinventory
/delay 5
/if (${Cursor.ID}) /goto :LootIt
} else {
/destroy
}
/return
[/code]
Posted: Mon Jul 19, 2004 2:10 pm
by A_Druid_00
Love this macro for normal playing, but I added
before the stand up command so that I can use it while adventuring and still be able to do other things like mem spells, med for short periods, etc.
Posted: Mon Aug 30, 2004 12:48 pm
by PhoenixZorn
This macro is my choice for the MQ2 Forage macro. It will be packaged with the OOW release. Bootyjuice, please clean it up JUST A LITTLE... I like tight little macros... and while yours is clean, it isn't tight... too many spaces. =)
Posted: Mon Aug 30, 2004 1:25 pm
by aChallenged1
It wouldn't take much to make this an INC so that you could run your normal macro.
Code: Select all
|** 8/30/04
yafm.mac
Yet Another Forage Macro
Ini File: yafm.ini
0 = destroy
1 = keep
Originally created by bottyjuice, modified by aChallenged to include a toggle.
New foraged items are added to the ini file automatically and are kept by default.
You will need a hotkey as follows to toggle it in game.
HOTKEY toggle switch:
Page2Button2Name=FrgSwch
Page2Button2Color=15
Page2Button2Line1=/docommand ${If[${Forage},/varset Forage 0,/varset Forage 1]}
**|
||||||||||||||||||||
| Main
||||||||||||||||||||
sub Main
/declare Forage int outer
/varset Forage 1
/cleanup
| Verify that we have the ability to forage.
/if (${Me.Skill[Forage]}==0) {
/echo You cannot forage, silly person!
/goto :Exit
}
:Forage
| Stand up. Can't forage while sitting.
/if (${Me.State.NotEqual[STAND]}) {
/stand
/delay 5
}
/delay 1s
| If we can forage then do so.
/if ( ${Forage}==1 && ${Me.AbilityReady[Forage]}) {
/doability forage
}
| If we successfully foraged something then take care of it.
/if (${Cursor.ID}) {
/call HandleItem
}
/goto :Forage
:Exit
/return
||||||||||||||||||||
| HandleItem
||||||||||||||||||||
sub HandleItem
/declare ItemSetting int local
/declare NotFound int local
/varset NotFound -1
| 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}" "1"
/varset ItemSetting 1
}
| If we're keeping this item then stash it in our bags.
| Otherwise, just destroy it.
/if (${ItemSetting}==1) {
:LootIt
/autoinventory
/delay 5
/if (${Cursor.ID}) /goto :LootIt
} else {
/destroy
}
/return
Posted: Tue Aug 31, 2004 1:39 pm
by mdar
Just to really mess the thread up - here's another version...
Changes:
* Moved item handling into main loop - items are only cleared from cursor immediately after forage.
* Changed keep/delete ini to keep at max... Setting of 0 will destroy all, setting of 20 will keep at most one stack, and delete any additional. Set roots=20 to always stay fed, but not overflowing with roots...
* Added defaultmax, this is the number that will automatically be saved for a new item type.
******WARNING****** DO NOT set defaultmax to 0. If you are using your inventory when a forage happens, it will on occasion treat an item you have in your hand as a forage result, and as such, will be added into your ini file. If DefaultMax = 0, the item will be DELETED.
Code: Select all
|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.
||||||||||||||||||||
| 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
}
/cleanup
| 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 do so.
/if (${Me.AbilityReady[Forage]}) {
| Stand up. Can't forage while sitting.
/if (${Me.State.NotEqual[STAND]}) {
/stand
/delay 5
}
/doability forage
}
| If we successfully foraged something then take care of it.
/if (${Cursor.ID}) {
/call HandleItem
}
/goto :Forage
:Exit
/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 ${FindItem=${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
Posted: Mon Sep 06, 2004 1:24 pm
by Skate4mindgame
Macro isnt destroying items i have set to "0" for some reason any suggestions? It is just throwing everything in my inventory
[Default]
MaxSave=100
[ForageList]
Roots=0
Bookworm=0
Pod of Water=0
Miller Carrot=0
Berries=100
Vegetables=100
Fishing Grubs=0
Fruit=100
Griffon Eggs=100
Rabbit Meat=100
There's my ini file if you see any problems.
Posted: Sun Sep 19, 2004 11:01 am
by Moeymoejoe
To fix the Mdar code repalce :
/varset ItemsHave ${FindItem=${Cursor.Name}}
with
/varset ItemsHave ${FindItemCount[=${Cursor.Name}]}
(i havent tested, but think this will work)
Posted: Sun Sep 19, 2004 10:32 pm
by peach
mdar's wont work for me, it doesnt destroy anything set to 0 and it doesnt destroy anything when it exceeds the set amount
Posted: Sat Nov 27, 2004 6:07 pm
by Fibby
I modified the forage loop so that I could run it more or less full time..
Code: Select all
:Forage
/delay 1s
| If we can forage then do so.
/if (${Me.AbilityReady[Forage]}) {
/if (!${Me.Combat}) {
/varset lv_CurState ${Me.State}
/stand
/delay 2
/doability forage
/if (${String[${lv_CurState}].Equal[SIT]}) {
/sit
}
}
}
| If we successfully foraged something then take care of it.
/if (${Cursor.ID}) {
/call HandleItem
}
/goto :Forage
Posted: Thu Dec 02, 2004 4:18 am
by Jon100
There's a small bug in the logic that means you always loot one more item than you set in your ini. This means if you set your rabbit meat=0 it will still loot one, and if you set it to 20, you loot 21.
I was wondering for ages why it always seemed to keep a single rabbit meat and pod of water :)
change:
Code: Select all
/if (${ItemSetting}>=${ItemsHave}) {
to:
Code: Select all
/if (${ItemSetting}>${ItemsHave}) {
Posted: Thu Feb 24, 2005 12:22 pm
by Twen
just curious cant read code well but, does yafm take into effect natures bounty aa? chance to forage 2 items with one forage attempt?
Posted: Thu Feb 24, 2005 1:01 pm
by aChallenged1
Under HandleItem in the code it should autoinventory or destroy until cursor is clear.
Posted: Thu Feb 24, 2005 7:35 pm
by FallenAngel
this works fairly well however it keeps autoinventoring anything i pick up lol even when not foraging what would be the best way to fix it so it only autoinventories when foraging? and not when i pick up an item from my bags.
thanks in advance lol and i hope im not missing something easy
Posted: Thu Feb 24, 2005 7:51 pm
by aChallenged1
Search: autoskills plugin
If you are VIP also search autodestroy
Posted: Thu Feb 24, 2005 7:57 pm
by FallenAngel
thank you challenged =)