For u all who love to fish and forage

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

helstar
orc pawn
orc pawn
Posts: 21
Joined: Sat Jan 24, 2004 6:23 pm

For u all who love to fish and forage

Post by helstar » Mon Jan 26, 2004 8:07 pm

Well ive looked and looked, and could not find a fish,forage maco.
So i took what u guys have done and made one. Ive been running it for a long time now and havent got any problems. I would like to incorprate the summon drink thats on the pole in to the script but seem to be lost at that.

Code: Select all

|---------------------------- 
| Fish-forage.mac
| To all u who would love to fish and forage at the same time.
| I have merged the to mac together and they seem to be working fine.
| Been running it for over 2 hours and no problems as of yet.
| I want to give thanks to all who put time into makeing the two scripts.
| Forager with ini file support and 
| statistic gathering and reporting 
| version 2.1 
| Set this define to the desired .ini file 
| Requires a blank .ini file to start. The marco will 
| populate the .ini file automatically for any zone 
| and default to keeping the item. Then just change 
| the values in the .ini file to 0 for an item to be 
| automatically destroyed (requires FastItemDestroy 
| be turned on in the options window) 
| - Fish2.mac - 
| Updated fishing macro. 
| Mainly for people who have a fisherman's companion. 
| Put your fisherman's companion in an inventory slot to use this. 
| This macro will fish until out of bait, summoning poles when you 
| need a new one.  Once out of bait it will sit you down and camp you out. 
| be sure to edit the array so that it destroy's only what you don't want 
| to keep.  If you add or remove entries update the /varset DestArraySize. 
| 
| Updates for this mac will be soo. Ill try to work on incroprating the
| the summon el and drink it. aslo giveing u more skill to raise.





#define IniFile "forage.ini" 
#Event ZoneChange "Loading please wait" 
#event PrimaryHand "You need to put your fishing pole in your primary hand." 
#event OutOfBait "You can't fish without fishing bait, go buy some." 
#event NeedPole "You can't fish without a fishing pole, go buy one." 
#turbo 

Sub Main 
  /zapvar 
  /declare DestArraySize global 
  /declare tempvar global 
  /declare DestroyArray array 
  /declare ForageDelay global 
  /declare EnableShowStats global 
  /declare EnableWriteLog global 
  /declare EnableClear global 

| ##### User set variables ##### 
   /varset DestroyArray(0) "Tattered Cloth Sandal" 
   /varset DestroyArray(1) "Rusty Dagger" 
   /varset DestroyArray(2) "Fish Scales" 
   /varset DestroyArray(3) "Item to destroy" 
   /varset DestroyArray(4) "Item2 to destroy" 
|Add as many more of these lines as you want.  Just add 1 to the number in () and add 1 to DestArraySize for each. 
   /varset DestArraySize 4 

   /varset EnableShowStats 1        | Set to 1 to show foraging statistics 
   /varset EnableWriteLog 1         | Set to 1 to write statistics to MQLog 
   /varset EnableClear 0            | Set to 1 to clear before writing stats 

| ##### User set variables ##### 

  /declare ForageAttempts global 
  /declare ForageSuccess global 
  /declare ForageFailure global 
  /declare ForageKeeps global 
  /declare ForageDestroys global 
  /declare NumItem global 
  /declare Index global 
  /declare ItemArray array2 

  /varset ForageAttempts 0 
  /varset ForageSuccess 0 
  /varset ForageFailure 0 
  /varset ForageKeeps 0 
  /varset ForageDestroys 0 
  /varset NumItem 0 
  /call LoadFromIni 

:Continue 
  /doevents 
  /varset Index 0 
  /if $char(state)==SIT { 
      /stand 
      /delay 3 
  } 
  /if n $char(ability,"Fishing")>0 { 
      /delay 1s 
      /if "$char(casting)"=="FALSE" { 
         /if "$cursor()"=="NULL" { 
            /doability Fishing 
            /doevents 
         } 
      } 
   } 
   /if n $char(ability,"Sneak")>0 { 
      /if "$char(casting)"=="FALSE" { 
         /doability "Sneak" 
      } 
   } 
   /if n $char(ability,"Hide")>0 { 
      /if "$char(casting)"=="FALSE" { 
         /doability "Hide" 
      } 
   } 
   /if "$cursor()"!="NULL" /call ItemSub 
   /doevents 
   /if "$cursor()"!="NULL" /call ItemSub 


  /if n $char(ability,"Forage")>0 { 
     /doability Forage 
     /varadd ForageAttempts 1 
     /if "$cursor(name)"=="NULL" { 
       /varadd ForageFailure 1 
     } else { 
       /varadd ForageSuccess 1 
       /call CheckItem 
       /call HandleItem 
|       /beep 
     } 
  } 
  /if @EnableWriteLog==1 /call LogStats 
  /if @EnableShowStats==1 /call ShowStats 
  /goto :Continue 

/return 

| ########## Subroutines ########## 
Sub Event_ZOneChange 
   /delay 1m 
   /call LoadFromIni 
/return 

Sub LoadFromIni 
   /varset NumItem 0 
   /declare IniPosition local 
   /declare IniList local 
   /declare tmpItem local 
   /varset IniList $ini(IniFile,"Global") 
   /if "@IniList"!~"NOTFOUND||" { 
      /varset IniPosition 0 
      :CheckGlobalForage 
         /varadd IniPosition 1 
         /varadd NumItem 1 
         /varset ItemArray(0,@NumItem) "$arg($int(@IniPosition),"@IniList",|)" 
         /varset ItemArray(1,@NumItem) $ini(IniFile,"Global","@ItemArray(0,@NumItem)") 
|  Setting the second column to 0 in the array at zoneout/in.  Originally wasn't getting set and would cause stats to bail. 
         /varset ItemArray(2,@NumItem) 0 
      /if "$arg($int($calc(@IniPosition+1)),"@IniList",|)"!="" /goto :CheckGlobalForage 
   } 
   /varset IniList "$ini(IniFile,"$zone")" 
   /if "@IniList"!~"NOTFOUND||" { 
      /varset IniPosition 0 
      :CheckZoneForage 
         /varadd IniPosition 1 
         /varadd NumItem 1 
         /varset ItemArray(0,@NumItem) "$arg($int(@IniPosition),"@IniList",|)" 
         /varset ItemArray(1,@NumItem) $ini(IniFile,"$zone","@ItemArray(0,@NumItem)") 
         /varset ItemArray(2,@NumItem) 0 
      /if "$arg($int($calc(@IniPosition+1)),"@IniList",|)"!="" /goto :CheckZoneForage 
   } 
/return 

Sub LogStats 
  /declare xy local  
  /if @EnableClear==1 /mqlog clear 
  /mqlog ############################################# 
  /mqlog For Zone: $zone 
  /mqlog Attempts = $int(@ForageAttempts) 
  /mqlog Success  = $int(@ForageSuccess)  [$int($calc(@ForageSuccess/@ForageAttempts*100))%] 
  /mqlog Failures = $int(@ForageFailure)  [$int($calc(@ForageFailure/@ForageAttempts*100))%] 
  /mqlog Keeps    = $int(@ForageKeeps)    [$int($calc(@ForageKeeps/@ForageAttempts*100))%] 
  /mqlog Destroys = $int(@ForageDestroys) [$int($calc(@ForageDestroys/@ForageAttempts*100))%] 
  /mqlog [Idx] [Item] [Keep] [Qty] [%] 
  /mqlog ------------------------------------------- 
  /if n @NumItem>0 { 
    /for xy 1 to @NumItem 
       /mqlog [$int(@xy)] [@ItemArray(0,@xy)] [$int(@ItemArray(1,@xy))] [$int(@ItemArray(2,@xy))] [$int($calc(@ItemArray(2,@xy)/@ForageAttempts*100))%] 
    /next xy 
  } 
/return 

Sub ShowStats 
  /declare xy local 
  /if @EnableClear==1 /clear 
  /echo ############################################# 
  /echo For Zone: $zone 
  /echo Attempts = $int(@ForageAttempts) 
  /echo Success  = $int(@ForageSuccess)  [$int($calc(@ForageSuccess/@ForageAttempts*100))%] 
  /echo Failures = $int(@ForageFailure)  [$int($calc(@ForageFailure/@ForageAttempts*100))%] 
  /echo Keeps    = $int(@ForageKeeps)    [$int($calc(@ForageKeeps/@ForageAttempts*100))%] 
  /echo Destroys = $int(@ForageDestroys) [$int($calc(@ForageDestroys/@ForageAttempts*100))%] 
  /echo [Idx] [Item] [Keep] [Qty] [%] 
  /echo ------------------------------------------- 
  /if n @NumItem>0 { 
    /for xy 1 to @NumItem 
      /echo [$int(@xy)] [@ItemArray(0,@xy)] [$int(@ItemArray(1,@xy))] [$int(@ItemArray(2,@xy))] [$int($calc(@ItemArray(2,@xy)/@ForageAttempts*100))%] 
    /next xy 
  } 
/return 


Sub CheckItem 
  /declare xy local 
  /if @NumItem==0 { 
    /varset NumItem 1 
    /call AddToArray 
    /varset Index 1 
  } else { 
    /for xy 1 to @NumItem 
      /if "@ItemArray(0,@xy)"=="$cursor(name)" /varset Index @xy 
    /next xy 
    /if @Index==0 { 
      /varadd NumItem 1 
      /call AddToArray 
    } else { 
      /varadd ItemArray(2,@Index) 1 
    } 
  } 
/return 

Sub AddToArray 
    /varset ItemArray(0,@NumItem) "$cursor(name)" 
    /varset ItemArray(1,@NumItem) $ini("IniFile","$zone","$cursor(name)") 
    /if "@ItemArray(1,@NumItem)"=="NOTFOUND" { 
      /varset ItemArray(1,@NumItem) 1 
      /ini "IniFile" "$zone" "$cursor(name)" 1 
    } 
    /varset ItemArray(2,@NumItem) 1 
/return 

Sub HandleItem 
  /if @ItemArray(1,@Index)==0 { 
    /varadd ForageDestroys 1 
    /click left destroy 
    /echo $cursor(name) should be destroyed. 
  } else { 
    /varadd ForageKeeps 1 
    /autoinv 
  } 
/return 

Sub ItemSub 
   :cursorloop1 
   /for tempvar 0 to @DestArraySize 
   /if "$cursor(name)"~~"@DestroyArray(@tempvar)" { 
      /destroy 
      /delay 1 
   } 
   /next tempvar 
   /if "$cursor()"=="TRUE" { 
      /autoinventory 
      /delay 1 
      /if "$cursor()"=="TRUE" /goto :cursorloop1 
   } 
/return 

Sub Event_NeedPole 
   /cast item "Fisherman's Companion" 
   /delay 11s 
   /autoinventory 
   /delay 1 
   :cursorloop2 
   /if "$cursor()"=="TRUE" { 
      /autoinventory 
      /delay 1 
      /goto :cursorloop2 
   } 
/return 

Sub Event_PrimaryHand 
   /cast item "Fisherman's Companion" 
   /delay 11s 
   /autoinventory 
   /delay 1 
   :cursorloop3 
   /if "$cursor()"=="TRUE" { 
      /autoinventory 
      /delay 1 
      /goto :cursorloop3 
   } 
/return 

Sub Event_OutOfBait 
   /if "$char(state)"=="STAND" /sit
  /camp
   /endmacro 
/return

helstar
orc pawn
orc pawn
Posts: 21
Joined: Sat Jan 24, 2004 6:23 pm

update to the scipt

Post by helstar » Mon Jan 26, 2004 10:49 pm

Code: Select all

|---------------------------- 
| Fish-forage.mac
| version 2
|My updates are as follows.
|U now my get drunk useing this script. added summon ale to the script.
|
| To all u who would love to fish and forage at the same time.
| I have merged the to mac together and they seem to be working fine.
| Been running it for over 2 hours and no problems as of yet.
| I want to give thanks to all who put time into makeing the two scripts.
| Forager with ini file support and 
| statistic gathering and reporting 
| version 2.1 
| Set this define to the desired .ini file 
| Requires a blank .ini file to start. The marco will 
| populate the .ini file automatically for any zone 
| and default to keeping the item. Then just change 
| the values in the .ini file to 0 for an item to be 
| automatically destroyed (requires FastItemDestroy 
| be turned on in the options window) 
| - Fish2.mac - 
| Updated fishing macro. 
| Mainly for people who have a fisherman's companion. 
| Put your fisherman's companion in an inventory slot to use this. 
| This macro will fish until out of bait, summoning poles when you 
| need a new one.  Once out of bait it will sit you down and camp you out. 
| be sure to edit the array so that it destroy's only what you don't want 
| to keep.  If you add or remove entries update the /varset DestArraySize. 
| 
| Updates for this mac will be soo. Ill try to work on incroprating the
| the summon el and drink it. aslo giveing u more skill to raise.





#define IniFile "forage.ini" 
#Event ZoneChange "Loading please wait" 
#event PrimaryHand "You need to put your fishing pole in your primary hand." 
#event OutOfBait "You can't fish without fishing bait, go buy some." 
#event NeedPole "You can't fish without a fishing pole, go buy one." 
#event Spillbeer "You spill your beer while bringing in your line."
#turbo 

Sub Main 
  /zapvar 
  /declare DestArraySize global 
  /declare tempvar global 
  /declare DestroyArray array 
  /declare ForageDelay global 
  /declare EnableShowStats global 
  /declare EnableWriteLog global 
  /declare EnableClear global 

| ##### User set variables ##### 
   /varset DestroyArray(0) "Tattered Cloth Sandal" 
   /varset DestroyArray(1) "Rusty Dagger" 
   /varset DestroyArray(2) "Fish Scales" 
   /varset DestroyArray(3) "Item to destroy" 
   /varset DestroyArray(4) "Item2 to destroy" 
|Add as many more of these lines as you want.  Just add 1 to the number in () and add 1 to DestArraySize for each. 
   /varset DestArraySize 4 

   /varset EnableShowStats 1        | Set to 1 to show foraging statistics 
   /varset EnableWriteLog 1         | Set to 1 to write statistics to MQLog 
   /varset EnableClear 0            | Set to 1 to clear before writing stats 

| ##### User set variables ##### 

  /declare ForageAttempts global 
  /declare ForageSuccess global 
  /declare ForageFailure global 
  /declare ForageKeeps global 
  /declare ForageDestroys global 
  /declare NumItem global 
  /declare Index global 
  /declare ItemArray array2 

  /varset ForageAttempts 0 
  /varset ForageSuccess 0 
  /varset ForageFailure 0 
  /varset ForageKeeps 0 
  /varset ForageDestroys 0 
  /varset NumItem 0 
  /call LoadFromIni 

:Continue 
  /doevents 
  /varset Index 0 
  /if $char(state)==SIT { 
      /stand 
      /delay 3 
  } 
  /if n $char(ability,"Fishing")>0 { 
      /delay 1s 
      /if "$char(casting)"=="FALSE" { 
         /if "$cursor()"=="NULL" { 
            /doability Fishing 
            /doevents 
         } 
      } 
   } 
   /if n $char(ability,"Sneak")>0 { 
      /if "$char(casting)"=="FALSE" { 
         /doability "Sneak" 
      } 
   } 
   /if n $char(ability,"Hide")>0 { 
      /if "$char(casting)"=="FALSE" { 
         /doability "Hide" 
      } 
   } 
   /if "$cursor()"!="NULL" /call ItemSub 
   /doevents 
   /if "$cursor()"!="NULL" /call ItemSub 


  /if n $char(ability,"Forage")>0 { 
     /doability Forage 
     /varadd ForageAttempts 1 
     /if "$cursor(name)"=="NULL" { 
       /varadd ForageFailure 1 
     } else { 
       /varadd ForageSuccess 1 
       /call CheckItem 
       /call HandleItem 
|       /beep 
     } 
  } 
  /if @EnableWriteLog==1 /call LogStats 
  /if @EnableShowStats==1 /call ShowStats 
  /goto :Continue 

/return 

| ########## Subroutines ########## 
Sub Event_ZOneChange 
   /delay 1m 
   /call LoadFromIni 
/return 

Sub LoadFromIni 
   /varset NumItem 0 
   /declare IniPosition local 
   /declare IniList local 
   /declare tmpItem local 
   /varset IniList $ini(IniFile,"Global") 
   /if "@IniList"!~"NOTFOUND||" { 
      /varset IniPosition 0 
      :CheckGlobalForage 
         /varadd IniPosition 1 
         /varadd NumItem 1 
         /varset ItemArray(0,@NumItem) "$arg($int(@IniPosition),"@IniList",|)" 
         /varset ItemArray(1,@NumItem) $ini(IniFile,"Global","@ItemArray(0,@NumItem)") 
|  Setting the second column to 0 in the array at zoneout/in.  Originally wasn't getting set and would cause stats to bail. 
         /varset ItemArray(2,@NumItem) 0 
      /if "$arg($int($calc(@IniPosition+1)),"@IniList",|)"!="" /goto :CheckGlobalForage 
   } 
   /varset IniList "$ini(IniFile,"$zone")" 
   /if "@IniList"!~"NOTFOUND||" { 
      /varset IniPosition 0 
      :CheckZoneForage 
         /varadd IniPosition 1 
         /varadd NumItem 1 
         /varset ItemArray(0,@NumItem) "$arg($int(@IniPosition),"@IniList",|)" 
         /varset ItemArray(1,@NumItem) $ini(IniFile,"$zone","@ItemArray(0,@NumItem)") 
         /varset ItemArray(2,@NumItem) 0 
      /if "$arg($int($calc(@IniPosition+1)),"@IniList",|)"!="" /goto :CheckZoneForage 
   } 
/return 

Sub LogStats 
  /declare xy local  
  /if @EnableClear==1 /mqlog clear 
  /mqlog ############################################# 
  /mqlog For Zone: $zone 
  /mqlog Attempts = $int(@ForageAttempts) 
  /mqlog Success  = $int(@ForageSuccess)  [$int($calc(@ForageSuccess/@ForageAttempts*100))%] 
  /mqlog Failures = $int(@ForageFailure)  [$int($calc(@ForageFailure/@ForageAttempts*100))%] 
  /mqlog Keeps    = $int(@ForageKeeps)    [$int($calc(@ForageKeeps/@ForageAttempts*100))%] 
  /mqlog Destroys = $int(@ForageDestroys) [$int($calc(@ForageDestroys/@ForageAttempts*100))%] 
  /mqlog [Idx] [Item] [Keep] [Qty] [%] 
  /mqlog ------------------------------------------- 
  /if n @NumItem>0 { 
    /for xy 1 to @NumItem 
       /mqlog [$int(@xy)] [@ItemArray(0,@xy)] [$int(@ItemArray(1,@xy))] [$int(@ItemArray(2,@xy))] [$int($calc(@ItemArray(2,@xy)/@ForageAttempts*100))%] 
    /next xy 
  } 
/return 

Sub ShowStats 
  /declare xy local 
  /if @EnableClear==1 /clear 
  /echo ############################################# 
  /echo For Zone: $zone 
  /echo Attempts = $int(@ForageAttempts) 
  /echo Success  = $int(@ForageSuccess)  [$int($calc(@ForageSuccess/@ForageAttempts*100))%] 
  /echo Failures = $int(@ForageFailure)  [$int($calc(@ForageFailure/@ForageAttempts*100))%] 
  /echo Keeps    = $int(@ForageKeeps)    [$int($calc(@ForageKeeps/@ForageAttempts*100))%] 
  /echo Destroys = $int(@ForageDestroys) [$int($calc(@ForageDestroys/@ForageAttempts*100))%] 
  /echo [Idx] [Item] [Keep] [Qty] [%] 
  /echo ------------------------------------------- 
  /if n @NumItem>0 { 
    /for xy 1 to @NumItem 
      /echo [$int(@xy)] [@ItemArray(0,@xy)] [$int(@ItemArray(1,@xy))] [$int(@ItemArray(2,@xy))] [$int($calc(@ItemArray(2,@xy)/@ForageAttempts*100))%] 
    /next xy 
  } 
/return 


Sub CheckItem 
  /declare xy local 
  /if @NumItem==0 { 
    /varset NumItem 1 
    /call AddToArray 
    /varset Index 1 
  } else { 
    /for xy 1 to @NumItem 
      /if "@ItemArray(0,@xy)"=="$cursor(name)" /varset Index @xy 
    /next xy 
    /if @Index==0 { 
      /varadd NumItem 1 
      /call AddToArray 
    } else { 
      /varadd ItemArray(2,@Index) 1 
    } 
  } 
/return 

Sub AddToArray 
    /varset ItemArray(0,@NumItem) "$cursor(name)" 
    /varset ItemArray(1,@NumItem) $ini("IniFile","$zone","$cursor(name)") 
    /if "@ItemArray(1,@NumItem)"=="NOTFOUND" { 
      /varset ItemArray(1,@NumItem) 1 
      /ini "IniFile" "$zone" "$cursor(name)" 1 
    } 
    /varset ItemArray(2,@NumItem) 1 
/return 

Sub HandleItem 
  /if @ItemArray(1,@Index)==0 { 
    /varadd ForageDestroys 1 
    /click left destroy 
    /echo $cursor(name) should be destroyed. 
  } else { 
    /varadd ForageKeeps 1 
    /autoinv 
  } 
/return 

Sub ItemSub 
   :cursorloop1 
   /for tempvar 0 to @DestArraySize 
   /if "$cursor(name)"~~"@DestroyArray(@tempvar)" { 
      /destroy 
      /delay 1 
   } 
   /next tempvar 
   /if "$cursor()"=="TRUE" { 
      /autoinventory 
      /delay 1 
      /if "$cursor()"=="TRUE" /goto :cursorloop1 
   } 
/return 

Sub Event_NeedPole 
   /cast item "Fisherman's Companion" 
   /delay 11s 
   /autoinventory 
   /delay 1 
   :cursorloop2 
   /if "$cursor()"=="TRUE" { 
      /autoinventory 
      /delay 1 
      /goto :cursorloop2 
   } 
/return 

Sub Event_PrimaryHand 
   /cast item "Fisherman's Companion" 
   /delay 11s 
   /autoinventory 
   /delay 1 
   :cursorloop3 
   /if "$cursor()"=="TRUE" { 
      /autoinventory 
      /delay 1 
      /goto :cursorloop3 
   } 
/return 

Sub Event_OutOfBait 
   /if "$char(state)"=="STAND" /sit
  /camp
   /endmacro 
/return


Sub Event_Spillbeer
	/cast item "Brell's Fishin' Pole"
	/delay 3s
	/autoinventory
	/press i
	/mouseto inv slot1
	/click right
	/press i
/return

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

Post by ml2517 » Mon Jan 26, 2004 10:50 pm

U
S
E

C
O
D
E

B
L
O
C
K
S

Onezero
a ghoul
a ghoul
Posts: 95
Joined: Thu Jan 01, 2004 1:19 pm
Location: Normal, IL
Contact:

Post by Onezero » Mon Jan 26, 2004 10:53 pm

Code: Select all

This is what a code block looks like.
If you notice all of the other macro posts, they use it, which probably means you should too.
.[b].[/b]:[b]:[/b] Onezero
"[i]Health is merely the slowest rate at which you can die.[/i]"

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

Post by Mckorr » Tue Jan 27, 2004 8:50 am

I fixed it for him.

User avatar
N0ne
decaying skeleton
decaying skeleton
Posts: 4
Joined: Tue Nov 04, 2003 6:36 pm

Post by N0ne » Sat Mar 06, 2004 7:22 am

W00t, that exact what I search.
Thanks
N0ne

insanity2k4
decaying skeleton
decaying skeleton
Posts: 1
Joined: Sat Mar 06, 2004 8:05 pm
Location: Cincinnati, OH
Contact:

Am I retarded?

Post by insanity2k4 » Sat Mar 06, 2004 8:13 pm

I'm not a big fan presently of writing/fixing scripts because I'm far too busy for that lately. Anyways... the "stats" that occupy the MQ window don't work. This is updating properly, just not pulling information right. Other than that, script is fine by me.
-insanity
%toonname% on %servername%

GD
a snow griffon
a snow griffon
Posts: 353
Joined: Sat Jun 29, 2002 11:57 pm

Post by GD » Sun Mar 07, 2004 5:01 pm

Also, if there is any lag after the forage, it might miss checking the ini file, so put a small delay after it, like so:

Code: Select all

     /doability Forage 
     [color=red]/delay 5[/color]
Opinions are like assholes, everyone has one, but most of them stink.