Summon Food and Drink Now MQ2Data Compliant

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

draco
a ghoul
a ghoul
Posts: 145
Joined: Thu Jan 29, 2004 7:06 pm
Contact:

Summon Food and Drink Now MQ2Data Compliant

Post by draco » Thu Mar 18, 2004 9:37 am

This macro setup up and event handler to summon food and drink. meant to be included in Bot/hunter macros.

I also wrote a summonFood.mac and summonDrink.mac to be used as command line versions.

Comming Soon: LootFilter w/ ini Support

Code: Select all

|
|
|FoodAndDrink.inc
|Version: 1.0
|
|Author: Draco
|
|Usage: Add
|	/call initFoodAndDrink "Name of Food Summoning Spell" "Name of Drink Summoning Spell"
|		in your setup. For Example: /call initFoodAndDrink "Summon Food" "Summon Drink"
|	Add
|	/call CheckFoodAndDrink
|		somewhere in your main loop
|
|Note:
|
|	This include requires SpellCast.ini
|TODO:
|	Add Reload previously memorized spell. SpellCast.ini automatically load any unmemmed spell into slot 5
|



#include SpellCast.inc

#Event Drink "You are out of drink"
#Event Food "You are out of food"

Sub initFoodAndDrink
	/declare NeedFood	global
	/varset NeedFood	0
	/declare NeedDrink	global
	/varset NeedDrink	0
	/declare summonFoodSpell global
	/declare summonDrinkSpell global

	/varset summonDrinkSpell "Summon Drink"
 	/varset summonFoodSpell "Summon Food"

	/if (${Defined[Param0]}==TRUE) /varset summonFoodSpell  "@Param0"

	/if (${Defined[Param1]}==TRUE) /varset summonDrinkSpell  "@Param1"


	/echo "summoning Food With @summonFoodSpell"
	/echo "summoning Drink With @summonDrinkSpell"

/return

Sub CheckFoodStatus
	/echo Checking Food @NeedFood
		/newif (@NeedFood==1) {
			/call SummonFood 5
		}
	/echo Checking Drink  @NeedDrink
		/newif (@NeedDrink==1) {
			/call SummonDrink 5
		}

	/varset NeedDrink 0
	/varset NeedFood 0
/return


Sub SummonFood
	/declare cnt local
	/echo Casting @summonFoodSpell
	/for cnt 1 to @Param0 step 1 {
		/call Cast "@summonFoodSpell"
	  :foodLoop
		/autoinventory
		/if (${Bool[${Cursor}]}) /goto   :foodLoop
		/doevents
	}
	/next cnt
/return

Sub SummonDrink
	/declare cnt local
	/echo Casting @summonDrinkSpell
	/for cnt 1 to @Param0 step 1 {
		/call Cast "@summonDrinkSpell"
	  :drinkLoop
		/autoinventory
		/if (${Bool[${Cursor}]}) /goto   :drinkLoop
		/doevents
	}

	/next cnt

/return


Sub Event_Drink
	/varset NeedDrink 1
	/echo "Setting NeedDrink to @NeedDrink"
/return

Sub Event_Food
	/varset NeedFood 1
	/echo "Setting NeedFood to @NeedFood"
/return


Summon Food

Code: Select all

|
|SummonFood.mac
|
|Author: Draco
|
|
|TODO:
|	Validate input Param
|


#include FoodAndDrink.inc

Sub Main(count)

	/call initFoodAndDrink
	/call SummonFood "@count"

/return

Summon Drink

Code: Select all

|
|SummonDrink.mac
|
|Author: Draco
|
|
|TODO:
|	Validate input Param
|



#include FoodAndDrink.inc

Sub Main(count)

	/call initFoodAndDrink
	/call SummonDrink "@count"

/return

Last edited by draco on Sat Apr 24, 2004 8:17 am, edited 4 times in total.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Mar 18, 2004 7:39 pm

Multiline comments are the debil. I'd use single line comments to be safe.

draco
a ghoul
a ghoul
Posts: 145
Joined: Thu Jan 29, 2004 7:06 pm
Contact:

Post by draco » Fri Mar 19, 2004 12:58 pm

Has been working great. But if it works better for others with single quotes. Not a problem. Enjoy!

draco
a ghoul
a ghoul
Posts: 145
Joined: Thu Jan 29, 2004 7:06 pm
Contact:

Udated for MQ2Data

Post by draco » Sat Apr 24, 2004 8:19 am

The update is complete and tested with and Updated version of SpellCast.inc found in the snippets section.