adding tracking to forage macro

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

adding tracking to forage macro

Post by bzt » Thu Mar 04, 2004 2:39 pm

I have tried several different ways, but cant seem to combine the 2

I would like to add the abilty to train tracking while I am foraging

Code: Select all

| skill.mac 

Sub Main 
      :main 
           /if $char(ability,"Tracking")>0 /doability "Tracking" 
/goto :main 
/return 

/return
 
works for training tracking..how can I add it to...

Code: Select all

|---------------------------- 
| 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) 

#define INIFile ".\forage.ini" 
#turbo 

Sub Main 
  /declare ForageDelay global 
  /declare EnableShowStats global 
  /declare EnableWriteLog global 
  /declare EnableClear global 

| ##### User set variables ##### 
  /varset ForageDelay 1010         | The delay between forage attempts 
  /varset EnableShowStats 0        | Set to 1 to show foraging statistics 
  /varset EnableWriteLog 0         | 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 

:Continue 
  /varset Index 0 
  /call Forage 
  /if "$cursor(name)"=="NULL" { 
    /varadd ForageFailure 1 
  } else { 
    /varadd ForageSuccess 1 
    /call CheckItem 
    /call HandleItem 
  } 

  /if @EnableShowStats==1 /call ShowStats 
  /if @EnableWriteLog==1 /call LogStats 
  /delay @ForageDelay 
  /goto :Continue 

/return 

| ########## Subroutines ########## 

Sub Forage 
  /if $char(state)!=STAND /stand
  /doability Forage 
  /varadd ForageAttempts 1 
  /delay 15 
/return 
/if $char(state)!=SIT /sit
Sub LogStats 
  /declare xy local 
  /call CalculateRates 
  /if @EnableClear==1 /mqlog clear 
  /mqlog ############################################# 
  /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 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 
  } else { 
    /varadd ForageKeeps 1 
    /autoinv 
  } 

/return 

I used search..couldnt find answer..and yes, I guess I may be stupid if I cant figure this out.

User avatar
SimpleMynd_01
a lesser mummy
a lesser mummy
Posts: 71
Joined: Thu May 08, 2003 3:16 pm

Post by SimpleMynd_01 » Thu Mar 04, 2004 3:57 pm

Change this:

Code: Select all

:Continue 
  /varset Index 0 
To this:

Code: Select all

:Continue 
  [color=red]/if $char(ability,"Tracking")>0 /doability "Tracking" [/color]
  /varset Index 0 
SimpleMynd

bzt
a lesser mummy
a lesser mummy
Posts: 77
Joined: Fri Oct 10, 2003 3:39 pm

Post by bzt » Thu Mar 04, 2004 11:36 pm

THANKS!