forage.mac

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

forage.mac

Post by Mckorr » Thu Apr 29, 2004 12:51 pm

A simple script that does nothing but forage, placing anything picked up into inventory.

Code: Select all

sub Main
	/sit off
	:MainLoop
		/if (${Cursor.ID}) /autoinv
		/if (${Cursor.ID}) /goto :CursorLoop
		/if (${Me.AbilityReady["Forage"]}) /doability "Forage" 

		:CursorLoop
			/if (${Cursor.ID}) /autoinv 
			/if (${Cursor.ID}) /goto :CursorLoop
		/goto :MainLoop
/endmacro

iluvseq
Clueless Mudslinger
Posts: 269
Joined: Mon Apr 14, 2003 10:05 am

Re: forage.mac

Post by iluvseq » Thu Apr 29, 2004 12:59 pm

And here it is without the redundancy:

Code: Select all

sub Main
	/sit off
	:MainLoop
		/if (${Cursor.ID}) /autoinv
		/if (${Cursor.ID}) /goto :MainLoop
		/if (${Me.AbilityReady["Forage"]}) /doability "Forage" 
		/goto :MainLoop
/endmacro

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Thu Apr 29, 2004 1:52 pm

Nope, the redundancy is there on purpose. It's to make sure the cursor is clear before you try to forage (like, you had your weapon there for some unknown reason). Keeps you from hitting the forage button before the cursor is cleared.

A cleaner way would be

Code: Select all

sub Main
     /sit off
     :MainLoop
          /if (${Cursor.ID}) /autoinv
          /if (!${Cursor.ID}&&${Me.AbilityReady["Forage"]}) /doability "Forage"
          /goto :MainLoop
/endmacro
That way you have to have a clean cursor before you forage, and if not you autoinv whatever is on it.

iluvseq
Clueless Mudslinger
Posts: 269
Joined: Mon Apr 14, 2003 10:05 am

Post by iluvseq » Thu Apr 29, 2004 10:08 pm

Not to be pedantic, but my post cleans the cursor just as well as your first post did... read it closely.

There is no reason to have a seperate "CursorLoop" repeating the first two lines of "MainLoop' ...

Just call "MainLoop" halfway through if the cursor isn't clean.

However, your second version does get rid of the redundant loop, so I guess you got it, without realizing it :)