Files: food.mac, food.ini, common/buy.inc
I always keep the same food in drink going in my pack and thought a simple macro would be nice. Then decided it make it easy to change and use for others.
This macro uses Override's Buy.inc from his site:
http://www.soc-music.com/mq2/
Make sure you have this file, as I'm not posting it here.
v1.02 Changed lines checkings if the food/drink you needed was greater than 1. Need to be ">=" so it would still buy if you only needed 1.
v1.01 Added in a simple checker to make sure you have money on you. I couldn't really figure out a great way to do it. So I check to see that you at least have 5pp or 50gp.
Also added a ranger checker.
v1.00 Intial release.
Food.mac
Code: Select all
|- food.mac
|- By: Drumstix42
|- Date: August 29th, 2004
|- Credit to Override for buy.inc
|-- Description: Buys Food and Drink from a specific vendor with use of simple INI settings.
|-- Files: food.mac, food.ini, common/buy.inc
#include common/buy.inc
Sub Main
|-- Check Platinum and Gold. Sorry folks, silver just don't cut it
/if ( ((${Me.Platinum}<5)&&(${Me.Gold}<1))||((${Me.Platinum}<5)&&(${Me.Gold}<50)) ) {
/echo You need to have some money before you buy anything.
/end
}
|-- Total Wanted minus Current Drink
/declare DrinkNeeded int local ${Math.Calc[${Ini[food.ini,Drink,Ammount]}-${FindItemCount[=${Ini[food.ini,Drink,Name]}]}].Int}
/declare FoodNeeded int local ${Math.Calc[${Ini[food.ini,Food,Ammount]}-${FindItemCount[=${Ini[food.ini,Food,Name]}]}].Int}
|-- Ammount of each that will be bought
/declare DrinkWanted int local ${Ini[food.ini,Drink,Ammount]}
/declare FoodWanted int local ${Ini[food.ini,Food,Ammount]}
|-- Merchant Name
/declare MerchantName string local ${Ini[food.ini,Merchant,Name]}
|-- Names with quotes for Buy.inc
/declare DrinkName string local "${Ini[food.ini,Drink,Name]}"
/declare FoodName string local "${Ini[food.ini,Food,Name]}"
|-- Names again for the two echo's
/declare Drink string local ${Ini[food.ini,Drink,Name]}
/declare Food string local ${Ini[food.ini,Food,Name]}
|-- Make sure nothing is on the cursor first
/call ClearCursor
/echo Merchant: ${MerchantName}
/if (${DrinkNeeded}>1) {
/echo Buying ${DrinkNeeded} ${Drink}s
} else {
/echo Buying ${DrinkNeeded} ${Drink}
}
/if (${FoodNeeded}>1) {
/echo Buying ${FoodNeeded} ${Food}s
} else {
/echo Buying ${FoodNeeded} ${Food}
}
|-- Target Merchant, and buy food/drink if needed
/target npc ${MerchantName}
|-- Make sure Merchant is in range
/if (${Target.Distance}>20) {
/echo Merchant is too far away. Get closer!
/end
}
/nomodkey /click right target
/delay 1s
/if (${DrinkNeeded}>=1) /call Buy ${DrinkName} ${DrinkWanted}
/delay 1s
/if (${FoodNeeded}>=1) /call Buy ${FoodName} ${FoodWanted}
/delay 1s
/notify MerchantWnd DoneButton leftmouseup
/echo Done.
/return
Sub ClearCursor
:CusorLoop
/if (${Cursor.ID}) {
/autoinventory
/if (${Cursor.ID}) /goto :CusorLoop
}
/returnFood.ini Sample
Code: Select all
[Merchant]
Name=Vuli Ironstove
[Drink]
Name=Water Flask
Ammount=80
[Food]
Name=Iron Ration
Ammount=40The ammount is the ammount of food/drink you want to have after the macro is done. So if you have 20 current food, and want to have 40 overall, you would set ammount to 40.
I just kept the INI simple, since I only use 1 type of food or drink, but you can of course change it to anything you want, as this is just a sample.

