Fishing/Foraging hybrid macro

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

Moderator: MacroQuest Developers

digitalfreeze
decaying skeleton
decaying skeleton
Posts: 2
Joined: Mon Oct 04, 2004 1:36 am

Fishing/Foraging hybrid macro

Post by digitalfreeze » Fri Oct 08, 2004 2:23 am

Hi all,

This Macro is heavily based on both "Yet Another Forage Macro - yafm" and adv_fishing.mac. I simply combined the best attributes (in my opinion) of both because I wanted to be able to fish and forage at the same time. Thank you Panther and bootyjuice for your great macros!!!

Code: Select all

|--------------------------------------------------------------------------------- 
| Fishing and Foraging Macro 
|
|This Macro is heavily based on both "Yet Another Forage Macro - yafm" and 
|adv_fishing.mac. I simply combined the best attributes (in my opinion) of both
|because I wanted to be able to fish and forage at the same time. Thank you 
|Panther and bootyjuice for your great macros!!!
| 
|Usage: /mac fishandforage.mac ${Param0} ${Param1} ${Param2}
|${Param0} tell the macro if you want to fish (1=yes, 0=no)
|${Param1} tell the macro if you want to forage (1=yes, 0=no)
|${Param2} tell the macro if you want to Display Stats (1=yes, 0=no) 
|Example: /mac fishandforage.mac 1 1 1
|(in this case you would both fish, forage, as well as display the stats)
|
|Ini File: FishAndForage.ini 
| 
| 0 = destroy 
| 1 = keep 
| 
|This macro will fish and forage for you and keep all items in Fishandforage.ini.
|items are added to the ini file automatically and are kept by default. You need 
|a fisherman's companion in an inventory slot for the fishing portion of this 
|macro to work properly. 
|--------------------------------------------------------------------------------- 

#turbo 10 

#event BrokenPole "Your fishing pole broke!" 
#event LostBait "You lost your bait!" 
#event NeedPole "You can't fish without a fishing pole, go buy one." 
#event NothingCaught "You didn't catch anything." 
#event OutOfBait "You can't fish without fishing bait, go buy some." 
#event PrimaryHand "You need to put your fishing pole in your primary hand." 
#event SkillUpFish "You have become better at Fishing! (#2#)" 
#event SkillUpForage "You have become better at Forage! (#2#)"
#event SpillBeer "You spill your beer while bringing in your line." 

Sub Main 

   |------------------------------------------------------------ 
   |Should I display fishing/foraging stats? (1 for yes, 0 for no) 
   |------------------------------------------------------------ 
   /declare RV_DisplayStats     int outer  ${Param2} 


   /echo Starting up ${Macro} 
   /declare int_ItemsKept     int outer  0
   /declare int_BrokenPole     int outer  0 
   /declare int_ItemsDestroyed     int outer  0 
   /declare int_LostBait     int outer  0 
   /declare int_NothingCaught     int outer  0 
   /declare int_SpillBeer     int outer  0 
   /declare int_TotalCasts     int outer  0 
   /declare int_CanForage    int outer  1
   /declare int_TotalForages     int outer  0
   /declare int_WantToForage     int outer  ${Param1}
   /declare int_WantToFish     int outer  ${Param0}
   |------------------------------------------------------------ 
   |Fish And Forage
   |------------------------------------------------------------ 
   /cleanup

| Verify that we have the ability to forage. 
   /if (${Me.Skill[Forage]}==0) { 
      /echo You cannot forage, silly person! 
      /varset int_CanForage 0 
      }
 :Start 
   /call GMCheck 
   /delay 3s
   /if (${Cursor.ID}) /call Looting 
   /if (${int_WantToFish}==1 && ${Me.AbilityReady[Fishing]}) { 
         /delay 1s 
         /varcalc int_TotalCasts ${int_TotalCasts}+1 
         /doability Fishing 
      }
   /if (${Cursor.ID}) /call Looting
   /if (${int_WantToForage}==1 && ${int_CanForage}==1 && ${Me.AbilityReady[Forage]}) {
          /delay 1s 
          /varcalc int_TotalForages ${int_TotalForages}+1 
          /doability forage 
      }
   /doevents 
 /goto :Start 
/return 


|-------------------------------------------------------------------------------- 
|SUB: Display stats. 
|-------------------------------------------------------------------------------- 
Sub DisplayStats 

   
   /echo ${int_ItemsKept} - Items Kept 
   /echo ${int_ItemsDestroyed} - Items Destroyed
   /if (${int_WantToForage}==1 && ${int_CanForage}==1) {
         /echo Total Forage Attempts = ${int_TotalForages}
   }
   /if (${int_WantToFish}==1) {
     /echo Total number of casts = ${int_TotalCasts} 
   } 
   /echo ------------------ 
   /if (${int_WantToFish}==1) {
     /echo ${int_BrokenPole} - Broken poles  
     /echo ${int_LostBait} - Lost bait 
     /echo ${int_NothingCaught} - Nothing caught 
     /echo ${int_SpillBeer} - Spilt your beer
   }
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Check for GM's in zone. 
|-------------------------------------------------------------------------------- 
Sub GMCheck 

   /if (${Spawn[gm].ID}) { 
      /beep 
      /beep 
      /beep 
      /echo GM entered the zone! 
      /echo For safty reasons ending the macro... 
      /sit off 
      /sit on 
      /camp desktop
      /endmacro 
   } 

/return 

|-------------------------------------------------------------------------------- 
|SUB: Looting based on FishAndForage.ini. 
|-------------------------------------------------------------------------------- 
Sub Looting 

   /declare ItemSetting int local 
   /declare NotFound int local 

   /varset NotFound -1 

   | Look up this item in FishAndForage.ini 
   /varset ItemSetting ${Ini[FishAndForage.ini,ItemList,${Cursor.Name},${NotFound}]} 

   /delay 5 

   | If the item isn't in the .ini file then add it. 
   /if (${ItemSetting}==${NotFound}) { 

      /ini "FishAndForage.ini" "ItemList" "${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
      /varcalc int_ItemsKept ${int_ItemsKept}+1 
      /delay 5 
      /if (${Cursor.ID}) /goto :LootIt 

   } else { 

      /destroy 
      /varcalc int_ItemsDestroyed ${int_ItemsDestroyed}+1
   } 

   /if (${RV_DisplayStats}) /call DisplayStats
/return 


|-------------------------------------------------------------------------------- 
|SUB: Event subroutines. 
|-------------------------------------------------------------------------------- 
Sub Event_BrokenPole 
   /varcalc int_BrokenPole ${int_BrokenPole}+1 
   /varcalc int_NothingCaught ${int_NothingCaught}-1 
/return 

Sub Event_LostBait 
   /varcalc int_LostBait ${int_LostBait}+1 
   /varcalc int_NothingCaught ${int_NothingCaught}-1 
/return 

Sub Event_NeedPole 
   /cast item "Fisherman's Companion" 
   /delay 11s 
   /autoinventory 
/return 

Sub Event_NothingCaught 
   /varcalc int_NothingCaught ${int_NothingCaught}+1 
/return 

Sub Event_OutOfBait 
  /Echo Ran out of Bait. 
   /sit off 
   /sit on 
   /camp desktop
   /endmacro 
/return 

Sub Event_PrimaryHand 
   /cast item "Fisherman's Companion" 
   /delay 11s 
   /autoinventory 
/return 

Sub Event_SkillUpFish(SkillUpText,Skill,int Amount) 
   /popup Fishing increased to - ${Amount} 
   /echo Fishing increased to - ${Amount} 
/return

Sub Event_SkillUpForage(SkillUpText,Skill,int Amount) 
   /popup Forage increased to - ${Amount} 
   /echo Forage increased to - ${Amount} 
/return 

Sub Event_SpillBeer 
   /varcalc int_SpillBeer ${int_SpillBeer}+1 
   /varcalc int_NothingCaught ${int_NothingCaught}-1 
/return 
|--------------------------------------------------------------------------------

Shenlon
a ghoul
a ghoul
Posts: 103
Joined: Fri Jul 30, 2004 8:02 am

Post by Shenlon » Fri Oct 08, 2004 10:25 am

Awesome looking macro, I was thinking about doing something lke this myself :). Maybe later this evening i'll get a chance to test it.

wang001m
decaying skeleton
decaying skeleton
Posts: 6
Joined: Sat Jun 05, 2004 6:19 pm

Only uses forage, and wont fish

Post by wang001m » Thu Aug 18, 2005 12:31 am

it only uses forage and puts foraged items away... wont fish and put them away, have pole and everything

Leffe
a ghoul
a ghoul
Posts: 86
Joined: Mon Feb 14, 2005 4:59 pm

Post by Leffe » Sat Feb 11, 2006 6:13 am

same trouble as the fellow above... says i cant forge when i just wanna fish