HyperFish v1.0 Updated: 11/27/2004

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

Moderator: MacroQuest Developers

User avatar
Fibby
a lesser mummy
a lesser mummy
Posts: 58
Joined: Mon Nov 15, 2004 2:18 am

HyperFish v1.0 Updated: 11/27/2004

Post by Fibby » Fri Nov 26, 2004 6:35 pm

Read Comment Blocks inside code for more information:

HyperFish.mac

Code: Select all

|----------------------------------------------------------------------------
|     Name:	HyperFish.Mac													
|Developer: Fibby															
|     Date: 11/27/2004											
|----------------------------------------------------------------------------
|Purpose:	HyperFish is designed to be the next generation "smart" fishing	
|			automation macro.  It will auto replace any broken poles that	
|			may have met their demise at your hands either by searching your
|			inventory for one or summoning one from a fishermans companion 	
|																			
|			This Macro is INI driven for it's "loot" tables on a per zone	
|			basis.  However, if there's not a section for the zone you want	
|			to fish in the INI file, then it will create a new section for 	
|			your benifit.  													
|																			
|			If there are no loot items defined in the zone section of the 	
|			ini file, then the macro will assume that you want to "keep"	
|			all things that are edible and drop all "non food" items.  If   
|			in happens to fish a no-drop non food item, and that item is 	
|			not declared in your loot tables, then it will attempt to 	 	
|			destroy that item by default.  You can of course change that  	
|			flag if you wish.												
|																			
| Depends:	HyperLoot.ini - Same directory as this macro					
|----------------------------------------------------------------------------
|Credits:	This script was inspired by panther and his adv_fish macro		
|			while it is an outstanding macro.. I wanted something more...	
|----------------------------------------------------------------------------
|Revisions:
| v1.1  fby		Bug Fixes pointed out by Budman																	
| v1.0	fby		Created the initial file offering							
|----------------------------------------------------------------------------

#turbo 10


|----------------------------------------------------------------------------
| Event Declarations			
|----------------------------------------------------------------------------

#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 SkillUp "You have become better at #1#! (#2#)" 
#event SpillBeer "You spill your beer while bringing in your line." 


|----------------------------------------------------------------------------
| Main Macro Code				
|----------------------------------------------------------------------------

Sub Main

	|------------------------------------------------------------------------
    |User Settings = Set these please (1 for yes, 0 for no)	 
	|------------------------------------------------------------------------
	/declare UserVar_DisplayStats	int outer 1 
	/declare UserVar_CampOutFinish	int	outer 1
	/declare UserVar_DestroyNoDrop	int outer 1

	|------------------------------------------------------------------------
    | Counter data holders here				
	|------------------------------------------------------------------------
	/declare int_BrokenPole		int outer  0 
	/declare int_ItemsDropped	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 

	|------------------------------------------------------------------------
    | Operational Variables for this macro	
	|------------------------------------------------------------------------
	/declare op_int_GotLootArray	int outer 0
	/declare op_int_GotFishComp		int outer 0
	/declare op_int_FishByLoot		int outer 0
	/declare op_int_LoopCounter		int outer 0
	/declare op_int_ExitMacro		int outer 0
	
	/echo Starting up ${Macro} 
    | Check our inventory for Fish Comp.	
	/for op_int_LoopCounter 1 to 8
		/if (${InvSlot[pack${op_int_LoopCounter}].Item.Name.Equal["Fisherman's Companion"]}) {
			/echo Whoopie!! Found our Fisherman's Companion!
			/varset op_int_GotFishComp 1
			/goto :BreakForFindFishComp
		}
	/next op_int_LoopCounter
	:BreakForFindFishComp
	/varset op_int_LoopCounter 0
	
	|------------------------------------------------------------------------
    | Load in Loot Table. 					
	|------------------------------------------------------------------------
	/call ReadINI HyperFish.ini "${Zone.Name}" Loot 
    /varset op_int_GotLootArray ${Macro.Return}

	|------------------------------------------------------------------------
	| Inventory anything we may have on our cursor before starting
	|------------------------------------------------------------------------
	/autoinventory
	
	|------------------------------------------------------------------------
	| Heart of the whole fishing routine..	
	|------------------------------------------------------------------------
	:Fish 
	/if (${op_int_ExitMacro}==1) /goto :ExitMacro
	/call GMCheck 
	/delay 2s 
	/if (${Cursor.ID}) /call Looting 
	/if (${Me.AbilityReady[Fishing]}) { 
		 /delay 1s 
		 /varcalc int_TotalCasts ${int_TotalCasts}+1 
		 /doability Fishing 
	} 
	/doevents 
	/goto :Fish 
|----------------------------------------------------------------------------
| End our Macro		
|----------------------------------------------------------------------------
:ExitMacro
	/echo -= Total Stats for this Fishing Trip =-
	/call DisplayStats
	/if (${UserVar_CampOutFinish}=1) {
		/sit off 
		/sit on 
		/camp 
	}
/return



|----------------------------------------------------------------------------
| Begin Support sub routines		
|----------------------------------------------------------------------------
| ReadINI: Stolen from adv_fish code, modified to return 1 if 
|			loot table built or 0 of loot table not built.
|----------------------------------------------------------------------------
Sub ReadINI(FileName, ZoneName, KeyRoot)
	/declare loc_int_returnValue int local 0
	/echo Attempting to Read "${ZoneName}" Section from ${FileName}
	/delay 1s
	
	/if (${Ini[${FileName}, ${ZoneName}, -1, NO].Equal[NO]}) {
		/echo Zone "${ZoneName}" Not found, Creating it now...
		/Ini ${FileName}, ${ZoneName}, -1, -1
		/delay 1s
        | Obviously, since we didn't have a section, we're not going to
        | have a loot section.. so we can end now
		/return loc_int_returnValue
	}
	
	/declare nValues     int local  1 
	/declare nArray      int local  0 
    /declare KeySet      string local  ${Ini[${FileName},${SectionName}]} 
	
    :CounterLoop 
	/if (${String[${Ini[${FileName},${SectionName},${ArrayType}${nValues}]}].Equal[null]}) { 
		/varcalc nValues ${nValues}-1 
		/goto :MakeArray 
	} 
	/varcalc nValues ${nValues}+1 
    /goto :CounterLoop 
	
    :MakeArray 
	/if (!${nValues}) {
		| We didn't find any values in our loot tables.. so we'll just exit now
		/return loc_int_returnValue
	} else {
		| Must have found some values.. set our return variable now
		/varset loc_int_returnValue 1
	}
	/if (${FileName.Equal["HyperFish.ini"]}&&${nValues}>0) { 
		/echo Declaring Loot Array... 
		/declare RV_LootArray[${nValues}]  string outer 
		/declare RV_LootStats[${nValues}]  string outer 
	} 
	
	/for nArray 1 to ${nValues} 
		/if (${FileName.Equal["HyperFish.ini"]}) { 
			/varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]} 
			/varset RV_LootStats[${nArray}] 0 
		} 
	/next nArray 
	
	/echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 
	/delay 1s 
/return loc_int_returnValue

|----------------------------------------------------------------------------
|SUB: Display fishing stats. 
|----------------------------------------------------------------------------
Sub DisplayStats 
	/declare nArray  int local 
	/echo Total number of casts = ${int_TotalCasts} 
	/echo Items fished so far: 
	/if (${Defined[RV_LootArray]}) { 
		/for nArray 1 to ${RV_LootArray.Size} 
			/echo   ${RV_LootArray[${nArray}]} -  ${Int[${RV_LootStats[${nArray}]}]}
		/next nArray 
	} 
	/echo 
	/echo Bad fishing so far:
	/echo    Broken Poles - ${int_BrokenPole}
	/echo   Items Dropped - ${int_ItemsDropped}
	/echo       Lost Bait - ${int_LostBait}
	/echo  Nothing Caught - ${int_NothingCaught}
	/echo    Spilled Beer - ${int_SpillBeer}
/return 

|----------------------------------------------------------------------------
|SUB: Main Looting routine.. based on adv_fish, heavily modified. 
|----------------------------------------------------------------------------
Sub Looting 
	/declare LootCheck	int inner 0 
	
	/if (${op_int_GotLootArray}==0) {
		/if (${Cursor.Type.Equal["Food"]}) {
			/autoinventory
		}
	} else {	
		/for LootCheck 1 to ${RV_LootArray.Size} 
			/if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) { 
				/echo Keeping a ${Cursor.Name}... WOOT! 
				/varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1 
				/autoinventory 
			} 
		/next LootCheck 
	}
	/if (${Cursor.ID}) { 
		/if (${Cursor.NoDrop}) {
			/if (${UserVar_DestroyNoDrop}==1) {
				/destroy
			} else {
				/autoinventory
			}
		} else {
			/echo Dropping a ${Cursor.Name}... 
			/drop 
			/varcalc int_ItemsDropped ${int_ItemsDropped}+1 
		}
	} 
	/if (${UserVar_DisplayStats}==1) /call DisplayStats 
/return 

|----------------------------------------------------------------------------
|SUB: Pole replacement logic
|----------------------------------------------------------------------------
Sub FindPole
	/declare lv_int_Return int local 0
	/declare lv_int_LoopCounter int local 0
	/if (${op_int_GotFishComp}==1) {
		| We have our companion.. summon our pole
		/cast item "Fisherman's Companion" 
		/delay 11s 
		/autoinventory 
		/varset lv_int_Return 1
	} else {
		| We don't have a companion, find a fishing pole in inventory
		/for op_int_LoopCounter 1 to 8
			/if (${InvSlot[pack${op_int_LoopCounter}].Item.Container}) {
				/for lv_int_LoopCounter 1 to ${InvSlot[pack${op_int_LoopCounter].Container}
					/echo ${InvSlot[pack${op_int_LoopCounter}].Item.Name} - ${InvSlot[pack${op_int_LoopCounter}].Item.Item[${lv_int_LoopCounter}].Name}
					/if (${InvSlot[pack${op_int_LoopCounter}].Item.Item[${lv_int_LoopCounter}].Type.Equal["Fishing Pole"]}) {
						/ItemNotifiy pack${op_int_LoopCounter} rightmouseup
						/ItemNotify ${InvSlot[pack${op_int_LoopCounter}]} ${lv_int_LoopCounter} leftmouseup
						/autoinventory
						/varset lv_int_Return 1
						/goto :BreakoutLoop
					}
				/next lv_int_LoopCounter
			} else {
				/if (${InvSlot[pack${op_int_LoopCounter}].Item.Type.Equal["Fishing Pole"]}) {
					/itemnotify pack${op_int_LoopCounter} leftmouseup
					/autoinventory
					/varset lv_int_Return 1
					/goto :BreakoutLoop
				}
			}
		/next op_int_LoopCounter
	}
	:BreakoutLoop
	/if (${lv_int_Return}==0) {
		/echo Bummer.. We're out of Fishing Poles
		/varset op_int_ExitMacro 1
	}
/return lv_int_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... 
      /endmacro 
   } 

/return 

|----------------------------------------------------------------------------
| End Support sub routines			
|----------------------------------------------------------------------------

|----------------------------------------------------------------------------
| Begin Event Sub Routines			
|----------------------------------------------------------------------------
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 
	/call FindPole
/return


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


Sub Event_OutOfBait 
	/echo Bummer.. we're out of bait
	/varset op_int_ExitMacro 1
/return


Sub Event_PrimaryHand 
	/call FindPole
/return


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


Sub Event_SpillBeer
	/varcalc int_SpillBeer ${int_SpillBeer}+1 
	/varcalc int_NothingCaught ${int_NothingCaught}-1 
/return
|----------------------------------------------------------------------------
| End Event Sub Routines			
|----------------------------------------------------------------------------
HyperFish.ini

Code: Select all

[Neriak - Commons] 
Loot1=Fresh Fish 
Loot2=Fish Scales 

[The Plane of Nightmares] 
Loot1=Fresh Fish 
Loot2=Fish Scales 
Loot3=Crawdad 
Loot4=Waterleaf Scale 
Loot5=Nightmare Cichlid 

[The Plane of Valor] 
Loot1=Fresh Fish 
Loot2=Fish Scales 
Loot3=Crawdad 
Loot4=Vallorian Discus 

[North Qeynos]
Loot1=Fresh Fish
Loot2=Fish Scales
There is currently one known flaw in this macro.. and that is dealing with the FindPole routine when it's searching for a new fishing pole inside of your containers. Not sure why it's not working, but any assistance in debugging it would be appreciated.

While this macro is INI based, entries in the INI file for the zone your fishing in is not required. You just loose some flexability in what you keep and don't keep.
Last edited by Fibby on Sat Nov 27, 2004 6:40 pm, edited 1 time in total.
True genius is not knowing all the answers
It's knowing where to find them.

Budman
decaying skeleton
decaying skeleton
Posts: 2
Joined: Wed Sep 08, 2004 7:51 pm

Post by Budman » Sat Nov 27, 2004 4:58 pm

nice mac.

Small transposition Evnet keeping spilled beer and nothing caught counter at 0.

Code: Select all

Sub Evnet_SpillBeer
Budman

Budman
decaying skeleton
decaying skeleton
Posts: 2
Joined: Wed Sep 08, 2004 7:51 pm

Post by Budman » Sat Nov 27, 2004 5:22 pm

A couple of references to FishingLoot.ini from original mac still in there breaking what has been fished so far.

Code: Select all

   /if (${FileName.Equal["FishingLoot.ini"]}&&${nValues}>0) { 
      /echo Declaring Loot Array... 
      /declare RV_LootArray[${nValues}]  string outer 
      /declare RV_LootStats[${nValues}]  string outer 
   } 
    
   /for nArray 1 to ${nValues} 
      /if (${FileName.Equal["FishingLoot.ini"]}) { 
         /varset RV_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${ArrayType}${nArray}]} 
         /varset RV_LootStats[${nArray}] 0 
      } 
Also appears that if there is no values in the ini for the current zone, this portion is skipped giving the same result, but I am too lazy to fix. :smile:

Thanks again for the mac.

Budman

Ownz
decaying skeleton
decaying skeleton
Posts: 1
Joined: Fri Jan 14, 2005 2:49 pm

Post by Ownz » Wed Jan 19, 2005 5:56 am

I just started using this program a week ago... any way so i wanted to try out fishing, i used the default fishing that comes with it and then i used this one, the Default fishing i keep getting "" Cannot find /doability button "" and i have the hot key for fishing on my hot key list.... Your program i load it up it gets as far as to Echo the zone i'm in and nonething else happens... i have to Manualy press the fishing hot key and if i catch someting then it gets autoinventoried or droped... So if anyone can help me with either or both problems would be great

User avatar
Fibby
a lesser mummy
a lesser mummy
Posts: 58
Joined: Mon Nov 15, 2004 2:18 am

Post by Fibby » Thu Jan 20, 2005 1:09 am

Uhh..

Make sure you have setup "fishing" in your abilities tab....
True genius is not knowing all the answers
It's knowing where to find them.

Phox
orc pawn
orc pawn
Posts: 29
Joined: Fri Mar 19, 2004 6:44 am

Post by Phox » Fri Jan 21, 2005 2:30 pm

I'm at work and can't run the macro yet to see exactly what its doing. But the FindPole sub seems more complicated than necessary. In a macro I wrote to equip an insta-click item, I just used a simple code like this to find the item you are looking for...

Code: Select all

/itemnotify ${FindItem["Fishing Pole"].InvSlot.Pack} rightmouseup
/delay 1s
/itemnotify ${FindItem["Fishing Pole"].InvSlot} leftmouseup
/delay 1s
/autoinventory

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Fri Jan 21, 2005 4:11 pm

Phox, that might be due to the fact that the macro is meant to use, if availible, the Fishermans Companion. I'm sure you realized that, right?
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

Phox
orc pawn
orc pawn
Posts: 29
Joined: Fri Mar 19, 2004 6:44 am

Post by Phox » Fri Jan 21, 2005 7:06 pm

Theres already a check for that though. I didnt explicitly state it, but I was just talking about the code specifically looking for the Fishing Pole.

ionsf
a ghoul
a ghoul
Posts: 94
Joined: Wed Jan 14, 2004 10:19 pm

Post by ionsf » Mon Aug 08, 2005 12:17 am

This mac needs some work. I'm going to toy with it next.

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Tue Jul 11, 2006 2:53 am

Could someone post an updated version of this? It's about the only decent fishing mac I could find that doesn't require the bloody brells fishing companion junk.

I believe this line is the fault:

Code: Select all

   /if (${String[${Ini[${FileName},${SectionName},${ArrayType}${nValues}]}].Equal[null]}) { 
      /varcalc nValues ${nValues}-1 
      /goto :MakeArray 
   } 

PhoenixZorn
Macro Czar
Posts: 127
Joined: Fri Dec 12, 2003 2:20 pm
Contact:

Post by PhoenixZorn » Tue Jul 11, 2006 3:43 am

Amadeus, my Advanced Fishing Macro can be adapted easily to not use Brells... holy crap, I forgot I actually used to write damn good macros...

beergod
orc pawn
orc pawn
Posts: 27
Joined: Tue Oct 11, 2005 1:58 pm

Post by beergod » Wed Aug 09, 2006 8:56 pm

would some one be able to add the use of the Anizok's Bait Dispenser into this, between that and the brells one could fish forever with no need to buy polls, or bait :)

Would be cool if the ini file had a section for fish typps to use for bait conversions also with that

simkin
a snow griffon
a snow griffon
Posts: 303
Joined: Thu Sep 01, 2005 1:52 pm

Post by simkin » Thu Aug 10, 2006 7:47 pm

Well, I took a look at this and tried to get it working. I wasn't clear on the ini logic when a zone isn't listed in hyperfish.ini. I don't see why it tried to create a section and populate it with -1. So, I took it out. It should now keep all food for zones not in the .ini and if you have one, it will obey it.

The regular fishing pole logic should be working and it will summon a Brell pole as required.

I've also added in some perks for druids/rangers. You can have it keep InnateCammo on at all times. Also, if you are attacked, it will cast exodus, invis and camp out. Set the variables to turn this on

Anizok's Bait Dispenser logic implemented

Changed looting logic

Code: Select all

|**

HyperFish.Mac written by Simkin (Version 1.5 August 16th, 2006)

Based off HyperFish.mac by Fibby based & adv_fish.mac by Panther

Version History
---------------
Version 1.5 8/27/2006   - Switched to using Short Zone Names
Version 1.4 8/16/2006   - New [Destroy] section required to delete items
Version 1.3 8/11/2006   - add Anizok's Bait Dispenser
Version 1.2 8/10/2006   - inital re-write of HyperFish


========================
PURPOSE
========================
HyperFish is designed to be the next generation "smart" fishing automation macro.
It will auto replace any broken poles that may have met their demise at your hands either
by searching your inventory for one or summoning one from a Fisherman's Companion.

This Macro is INI driven for its "loot" tables on a per zone basis. If there is a Zone
definition found in the INI, the macro will only keep items listed in that section.

If there are no loot items defined in the zone section of the INI file, then the macro
will assume that you want to "keep" all things that are edible and drop all "non food"
items. 

If it happens to fish a no-drop, non-food item, and that item is not declared in
your loot tables, you can have the macro destroy it. Due to the dangers of this, it is
turned off by default.

========================
HOW TO USE
========================
The macro is best used with an accompanying INI file called HyperFish.ini
located in the same directory as this macro.  See below for a sample of how
to build one.

It is also recommended you use a Fisherman's Companion, obtained
very easily. See: http://everquest.allakhazam.com/db/item.html?item=16653
Place your Fisherman's Companion in one of your main inventory slot

It will use an Anizok's Bait Dispenser if you have one and enable the macro flag.
To use, place your Anizok's Bait Dispenser in slot 8

Inventory
 _______
| 1 | 5 |
|___|___|
| 2 | 6 |
|___|___|
| 3 | 7 |
|___|___|
| 4 | 8 |
|___|___|

Add a section to HyperFish.ini called [Bait] that lists all the fish you will
use to make bait with. e.g.

[Bait]
Loot1=Fresh Fish
Loot2=Green Fish
Loot3=and so on

Add a section to HyperFish.ini called [Destroy] that lists all the items you 
will destory if found on cursor e.g.

[Destroy]
Loot1=Rusty Dagger
Loot2=Tattered Cloth Sandal
Loot3=and so on


In the "USER SETTINGS" section, set various features to TRUE or FALSE

set_DisplayStats     - echo fishing stats each cast to window
set_CampOutOnFinish  - camp to select screen when macro ends gracefully (no pole/bait)
set_DropItems        - Drop items not in INI
set_DoInnateCammo    - remain hidden with Innate Camouflage AA
set_DoExodus         - if attacked, use Exodus AA to flee and then camp to desktop
set_UseBaitDispenser - use Anizok's Bait Dispenser

start the macro with /mac Hyperfish

Enjoy!


========================
SAMPLE HyperFish.ini
========================

[Eastern Plains of Karana]
Loot1=Thunder Salmon

[Neriak - Commons]
Loot1=Fresh Fish
Loot2=Fish Scales

[The Plane of Valor]
Loot1=Fresh Fish
Loot2=Fish Scales
Loot3=Crawdad
Loot4=Vallorian Discus


**|

#turbo 10

| ---------------------------------------------------------------------------
| Event Declarations
| ---------------------------------------------------------------------------
#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 SkillUp        "You have become better at #1#! (#2#)"
#event SpillBeer      "You spill your beer while bringing in your line."

#event Camo           "You return to view."

| Oh shit events
#event GotHit         "#*#hits YOU for#*#"
#event GotHit         "#*#slashes YOU for#*#"
#event GotHit         "#*#crushes YOU for#*#"
#event GotHit         "#*#bashes YOU for#*#"
#event GotHit         "#*#kicks YOU for#*#"
#event GotHit         "#*#smashes YOU for#*#"
#event GotHit         "#*#mauls YOU for#*#"
#event GotHit         "#*#gores YOU for#*#"
#event GotHit         "#*#pierces YOU for#*#"
#event GotHit         "#*#kicks YOU for#*#"
#event GotHit         "#*#bashes YOU for#*#"

| ===========================================================================
| Main Macro Code
| ===========================================================================
Sub Main

| ---------------------------------------------------------------------------
| USER SETTINGS - SET THESE AS REQURED (TRUE / FALSE)
| ---------------------------------------------------------------------------
/declare set_DisplayStats     bool outer TRUE
/declare set_CampOutOnFinish  bool outer FALSE
/declare set_DropItems        bool outer FALSE
/declare set_DoInnateCammo    bool outer FALSE
/declare set_DoExodus         bool outer FALSE
/declare set_UseBaitDispenser bool outer FALSE

| ---------------------------------------------------------------------------
| Counter data holders here - DO NOT CHANGE
| ---------------------------------------------------------------------------
/declare count_BrokenPole     int outer 0
/declare count_ItemsKept      int outer 0
/declare count_ItemsDropped   int outer 0
/declare count_ItemsDestroyed int outer 0
/declare count_LostBait       int outer 0
/declare count_NothingCaught  int outer 0
/declare count_SpillBeer      int outer 0
/declare count_TotalCasts     int outer 0
| ---------------------------------------------------------------------------
| Operational variables     - DO NOT CHANGE
| ---------------------------------------------------------------------------
/declare op_GotLootArray      int outer 0
/declare op_LoopCounter       int outer 0
/declare op_GotDestroyArray   bool outer FALSE
/declare op_ExitMacro         bool outer FALSE
/declare op_GotFishComp       bool outer FALSE

/echo Starting up ${Macro}
/echo WELCOME TO HYPERFISH v1.4
/echo =======================================================
| Check our inventory for Fisherman's Companion
/for op_LoopCounter 1 to 8
  /if (${InvSlot[pack${op_LoopCounter}].Item.Name.Equal["Fisherman's Companion"]}) {
    /echo FOUND OUR FISHERMAN'S COMPANION!
    /varset op_GotFishComp TRUE
  }
/next op_LoopCounter
/varset op_LoopCounter 0

| ---------------------------------------------------------------------------
| Load in Loot Table.
| ---------------------------------------------------------------------------
/call LoadLootArray HyperFish.ini "${Zone.ShortName}" Loot
/if (${set_UseBaitDispenser}) /call PopulateDispenser
/call LoadDestroyArray

| ---------------------------------------------------------------------------
| Inventory anything we may have on our cursor before starting
| ---------------------------------------------------------------------------
/autoinventory

| ---------------------------------------------------------------------------
| Main Fishing loop
| ---------------------------------------------------------------------------
/echo =======================================================
/echo Cast Away!
:Fish

/if (${op_ExitMacro}) /goto :ExitMacro
/if ((${set_DoInnateCammo}) && (!${Me.Buff[Camouflage].ID})) /alt activate 80
/call GMCheck
/delay 1s

/if (${Me.AbilityReady[Fishing]}) {
  /if (${Cursor.ID}) /call Looting
  /delay 1s
  /varcalc count_TotalCasts ${count_TotalCasts}+1
  /doability Fishing
}
/doevents

/goto :Fish

| ---------------------------------------------------------------------------
| End our Macro
| ---------------------------------------------------------------------------
:ExitMacro

/echo -= Total stats for this fishing trip =-
/call DisplayStats

/if (${set_CampOutOnFinish}) {
  /echo Camping to select screen
  /sit off
  /sit on
  /camp
}
/return


| ---------------------------------------------------------------------------
| SUB : Read HyperFish.ini and build zone looting information if available
| ---------------------------------------------------------------------------

Sub LoadLootArray(FileName, ZoneName, KeyRoot)
/echo Attempting to Read "${ZoneName}" Section from ${FileName}
/delay 1s

/if (${Ini[${FileName},${ZoneName},Loot1,NULL].Equal[NULL]}) {
   /echo The zone "${ZoneName}" was not found.
|   /ini "${FileName}" "${ZoneName}" -1 -1
|   /delay 1s
   /varset op_GotLootArray 0
   /return
}

| Build loot array
/declare nValues     int local  1
/declare nArray      int local  0

:CounterLoop
/if (${Ini[${FileName},${ZoneName},Loot${nValues},NULL].Equal[NULL]}) {
   /varcalc nValues ${nValues}-1
   /goto :MakeArray
}
/varcalc nValues ${nValues}+1

/goto :CounterLoop


:MakeArray

/if (${nValues} ==0) {
   /varset op_GotLootArray 0
   /return
}


/if (${nValues} >0) {
   /echo Creating Fishing Loot Array...
   /declare RV_LootArray[${nValues}]  string outer
   /declare RV_LootStats[${nValues}]  string outer
}

/for nArray 1 to ${nValues}

   /varset RV_LootArray[${nArray}] ${Ini[${FileName},"${ZoneName}",${KeyRoot}${nArray}]}
   /varset RV_LootStats[${nArray}] 0

/next nArray

/echo "${ZoneName}" Zone Information Read Successfully from ${FileName}...
/delay 1s
/varset op_GotLootArray 1
/return


| ---------------------------------------------------------------------------
| SUB: Display fishing stats.
| ---------------------------------------------------------------------------
Sub DisplayStats
/declare LootCheck   int inner 0

/echo Total number of casts = ${count_TotalCasts}
/if (${RV_LootArray.Size} >0) {
	/echo =======================================================
  /for LootCheck 1 to ${RV_LootArray.Size}
    /echo   ${RV_LootArray[${LootCheck}]} -  ${Int[${RV_LootStats[${LootCheck}]}]}
  /next LootCheck
  /echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
/echo        Items Kept - ${count_ItemsKept}
/echo     Items Dropped - ${count_ItemsDropped}
/echo   Items Destroyed - ${count_ItemsDestroyed}
/echo         Lost Bait - ${count_LostBait}
/echo      Broken Poles - ${count_BrokenPole}
/echo    Nothing Caught - ${count_NothingCaught}
/echo      Spilled Beer - ${count_SpillBeer}
/echo =======================================================
/return

| ---------------------------------------------------------------------------
| SUB: Main Looting routine
| ---------------------------------------------------------------------------
Sub Looting
/declare LootCheck   int inner 0

:ClearCursor

| Check the [Zone.ShortName] section to see if we want to keep this item
/for LootCheck 1 to ${RV_LootArray.Size}
  /if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) {
    /echo Keeping ${Cursor.Name}.
    /varcalc count_ItemsKept ${count_ItemsKept}+1
    /varcalc RV_LootStats[${LootCheck}] ${RV_LootStats[${LootCheck}]}+1
    /autoinventory
    /delay 5
    /goto :FinishLooting
  }
/next LootCheck


| Check the [bait] section to see if we want to keep this fish
/if (${set_UseBaitDispenser} && ${Cursor.ID}) {
  /for LootCheck 1 to ${Bait_LootArray.Size}
    /if (${Cursor.Name.Find[${Bait_LootArray[${LootCheck}]}]}) {
      /varcalc count_ItemsKept ${count_ItemsKept}+1
      /echo Keeping ${Cursor.Name} for bait.
      /autoinventory
      /delay 5
      /goto :FinishLooting
    }
  /next LootCheck
}

| Check the [Destroy] section to see if we want to destroy this item
/if (${op_GotDestroyArray}) {
  /for LootCheck 1 to ${Destroy_LootArray.Size}
    /if (${Cursor.Name.Find[${Destroy_LootArray[${LootCheck}]}]}) {
      /echo Destroying ${Cursor.Name}.
       /varcalc count_ItemsDestroyed ${count_ItemsDestroyed}+1
      /destroy
	  /delay 5
	  /goto :FinishLooting
    }
  /next LootCheck
}

| Otherwise place it in the inventory unless set_DropItems is TRUE
/if (${set_DropItems} && ${Cursor.ID} >0) {
  /echo Dropping ${Cursor.Name}...
  /drop
  /varcalc count_ItemsDropped ${count_ItemsDropped}+1
} else {
	/varcalc count_ItemsKept ${count_ItemsKept}+1
  /autoinventory
}
/delay 5

:FinishLooting
| Repeat this if cursor isn't empty
/if (${Cursor.ID} >0) /goto :ClearCursor
| /if ( ${Cursor.Name.Find[Homemade Bait]} ) /autoinventory

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

| ---------------------------------------------------------------------------
| SUB: Pole replacement logic
| ---------------------------------------------------------------------------
Sub FindPole
/declare PoleCounter int local 0

| We have our Fisherman's Companion, summon a fishing pole
/if (${op_GotFishComp}) {
  /cast item "Fisherman's Companion"
  /delay 11s
  /autoinventory
  /return
}

| We don't have a Fisherman's Companion, try to find a Fishing Pole
/echo SEARCHING FOR FISHING POLE
/for op_LoopCounter 1 to 8
  /if (${InvSlot[pack${op_LoopCounter}].Item.Container}) {
    /for PoleCounter 1 to ${InvSlot[pack${op_LoopCounter}].Item.Container}
|   /echo ${InvSlot[pack${op_LoopCounter}].Item.Name} - ${InvSlot[pack${op_LoopCounter}].Item.Item[${PoleCounter}].Name}
    /if (${InvSlot[pack${op_LoopCounter}].Item.Item[${PoleCounter}].Type.Equal["Fishing Pole"]}) {
      /if (!${Window[pack${op_LoopCounter}].Open}) /nomodkey /itemnotify pack${op_LoopCounter} rightmouseup
      /delay 3s ${Window[pack${op_LoopCounter}].Open}       
      /delay 5
      /nomodkey /itemnotify in pack${op_LoopCounter} ${PoleCounter} leftmouseup
      /delay 5           
      /autoinventory
      /nomodkey /itemnotify pack${op_LoopCounter} rightmouseup             
      /goto :BreakoutLoop
    }
    /next PoleCounter
    } else {
      /if (${InvSlot[pack${op_LoopCounter}].Item.Type.Equal["Fishing Pole"]}) {
        /nomodkey /itemnotify pack${op_LoopCounter} leftmouseup
        /delay 5
        /autoinventory
        /goto :BreakoutLoop
      }
    }
   
/next op_LoopCounter
/echo We're out of Fishing Poles.
/varset op_ExitMacro TRUE

:BreakoutLoop
/return

| ---------------------------------------------------------------------------
| SUB: Check for GM's in zone (yeah, yeah, we know).
| ---------------------------------------------------------------------------
Sub GMCheck
/if (${Spawn[gm].ID}) {
  /beep
  /beep
  /echo GM entered the zone!
  /echo For safty reasons ending the macro...
  /endmacro
}
/return

| ---------------------------------------------------------------------------
| SUB: Create Array of items to destory if on cursor 
| ---------------------------------------------------------------------------
Sub LoadDestroyArray

/echo Attempting to Read [Destroy] Section from HyperFish.ini

/if (${Ini["HyperFish.ini","Destroy",Loot1,NULL].Equal[NULL]}) {
  /echo [Destroy] section missing from HyperFish.ini. No items will be destroyed
  /varset op_GotDestroyArray FALSE     
  /return
}

| Build Destroy loot array
/declare nValues     int local  1
/declare nArray      int local  0

:DestroyCount
/if (${Ini["HyperFish.ini","Destroy",Loot${nValues},NULL].Equal[NULL]}) {
   /varcalc nValues ${nValues}-1
   /goto :MakeArray
}
/varcalc nValues ${nValues}+1
/goto :DestroyCount


:MakeArray
/echo I found ${nValues} different items I can destroy
  /if (!${nValues}) {
  /echo Something is wrong with your [Destroy] section
  /varset op_GotDestroyArray FALSE
  /return
}

/declare Destroy_LootArray[${nValues}]  string outer

/for nArray 1 to ${nValues}
  /varset Destroy_LootArray[${nArray}] ${Ini["HyperFish.ini","Destroy",Loot${nArray}]}
/next nArray

/delay 1s
/varset op_GotDestroyArray TRUE
/return


| ---------------------------------------------------------------------------
| SUB: Populate Anizok's Bait Dispenser array
| ---------------------------------------------------------------------------
Sub PopulateDispenser

/echo Attempting to Read [Bait] Section from HyperFish.ini

/if (${Ini["HyperFish.ini","Bait",Loot1,NULL].Equal[NULL]}) {
  /echo [Bait] section missing from HyperFish.ini. Turning off Bait Dispenser
  /varset set_UseBaitDispenser FALSE     
  /return
}

| Build Bait loot array
/declare nValues     int local  1
/declare nArray      int local  0

:BaitCount
/if (${Ini["HyperFish.ini","Bait",Loot${nValues},NULL].Equal[NULL]}) {
   /varcalc nValues ${nValues}-1
   /goto :MakeArray
}
/varcalc nValues ${nValues}+1
/goto :BaitCount


:MakeArray
/echo I found ${nValues} different items I can make bait with
  /if (!${nValues}) {
  /echo Something is wrong with your [bait] section
  /varset set_UseBaitDispenser FALSE
  /return
}

/declare Bait_LootArray[${nValues}]  string outer

/for nArray 1 to ${nValues}
  /varset Bait_LootArray[${nArray}] ${Ini["HyperFish.ini","Bait",Loot${nArray}]}
/next nArray

/delay 1s

/return


| ---------------------------------------------------------------------------
| SUB: MakeBait
| ---------------------------------------------------------------------------
Sub MakeBait
/declare BaitCounter int local 0
/declare BaitCompare int local 0


| Open Anizok's Bait Dispenser in slot 8
/echo Opening bait Dispenser
/if (!${Window[Pack8].Open}) /nomodkey /itemnotify pack8 rightmouseup
/delay 3s ${Window[Pack8].Open}

| Dig around and try and find a fish we can make bait out of
/for op_LoopCounter 1 to 7
  /if (${InvSlot[pack${op_LoopCounter}].Item.Container}) {
    /for BaitCounter 1 to ${InvSlot[pack${op_LoopCounter}].Item.Container}
      /for BaitCompare 1 to ${Bait_LootArray.Size}
      /if (${InvSlot[pack${op_LoopCounter}].Item.Item[${BaitCounter}].Name.Equal[${Bait_LootArray[${BaitCompare}]}]}) {
|        /echo WE GOT A CANDIDATE in pack${op_LoopCounter} slot ${BaitCounter}
         /if (!${Window[pack${op_LoopCounter}].Open}) /nomodkey /itemnotify pack${op_LoopCounter} rightmouseup
         /delay 3s ${Window[pack${op_LoopCounter}].Open}
         /delay 5
         /nomodkey /ctrlkey /itemnotify in pack${op_LoopCounter} ${BaitCounter} leftmouseup
         /delay 5
         /goto :ExitBaitLoops
       }
      /next BaitCompare
    /next BaitCounter
       
    } else {
      /for BaitCompare 1 to ${Bait_LootArray.Size}
        /if (${InvSlot[pack${op_LoopCounter}].Item.Name.Equal[${Bait_LootArray[${BaitCompare}]}]}) {
|          /echo WE GOT A CANDIDATE in slot ${op_LoopCounter}
          /nomodkey /ctrlkey /itemnotify pack${op_LoopCounter} leftmouseup
          /delay 5
          /goto :ExitBaitLoops
        }
      /next BaitCompare 
      }
     
/next op_LoopCounter

/echo We're out of Fishing Bait
/varset op_ExitMacro TRUE
/return

:ExitBaitLoops

| Make the Bait
/echo Making some bait.
/nomodkey /itemnotify in pack8 1 leftmouseup
/delay 5
/combine pack8
/delay 5
/autoinventory
/delay 5
/nomodkey /itemnotify pack8 rightmouseup
/delay 5
/nomodkey /itemnotify pack${op_LoopCounter} rightmouseup
/autoinventory
/varcalc count_ItemsKept ${count_ItemsKept}-1
/return


| ---------------------------------------------------------------------------
| Event Sub Routines
| ---------------------------------------------------------------------------
Sub Event_BrokenPole
/varcalc count_BrokenPole ${count_BrokenPole}+1
|/varcalc count_NothingCaught ${count_NothingCaught}-1
/return

Sub Event_LostBait
/varcalc count_LostBait ${count_LostBait}+1
|/varcalc count_NothingCaught ${count_NothingCaught}-1
/return

Sub Event_NeedPole
/call FindPole
/return

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

Sub Event_OutOfBait
/if (${set_UseBaitDispenser}) {
  /call MakeBait
} else {
/echo We're out of bait. Ending macro.
/varset op_ExitMacro TRUE
}
/return

Sub Event_PrimaryHand
/call FindPole
/return

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

Sub Event_SpillBeer
/varcalc count_SpillBeer ${count_SpillBeer}+1
|/varcalc count_NothingCaught ${count_NothingCaught}-1
/return

Sub event_Camo
/if ((${set_DoInnateCammo}) && (!${Me.Buff[Camouflage].ID})) {
  /echo "Camo dropped, activating AA"
  /alt activate 80
  /delay 5
}
/return

Sub event_GotHit
/beep
/echo UNDER ATTACK! You're gonna die.
/if (${set_DoExodus}) {
  /echo "Activating EXODUS and camping."
  /alt activate 43
  /delay 10
  /alt activate 80
  /delay 10
  /sit
  /camp desktop
  /endmacro
}
/return 
sample HyperFish.ini

Code: Select all

[Destroy]
Loot1=Tattered Cloth Sandal
Loot2=Fish Scales
Loot3=Rusty Dagger

[Bait]
Loot1=Fresh Fish
Loot2=Large Fetid Bass

[The Undershore]
Loot1=Tiny Blind Cave Fish

[Neriak - Commons]
Loot1=Fresh Fish
Loot2=Fish Scales

[The Plane of Nightmares]
Loot1=Fresh Fish
Loot2=Fish Scales
Loot3=Crawdad
Loot4=Waterleaf Scale
Loot5=Nightmare Cichlid
Last edited by simkin on Sun Aug 27, 2006 5:53 am, edited 5 times in total.

simkin
a snow griffon
a snow griffon
Posts: 303
Joined: Thu Sep 01, 2005 1:52 pm

Post by simkin » Fri Aug 11, 2006 8:17 am

I picked up one of those Anizok's Bait Dispenser thingies last night. Neat little toy, so I'll take a stab at adding it to this macro. However, if I end up using code from VIP macros, the updated macro will be moved to VIP.

simkin
a snow griffon
a snow griffon
Posts: 303
Joined: Thu Sep 01, 2005 1:52 pm

Post by simkin » Fri Aug 11, 2006 8:42 pm

Anizok's Bait Dispenser functionality has been added to my code posting above. Not very elegant but it seems to work ok from the limited testing I did.

Feedback is welcome.