clockwork.mac - Makes "Jar of Clockwork Grease"

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

Moderator: MacroQuest Developers

Chummer
orc pawn
orc pawn
Posts: 24
Joined: Fri Mar 12, 2004 1:58 am

clockwork.mac - Makes "Jar of Clockwork Grease"

Post by Chummer » Tue Mar 16, 2004 3:25 am

Code: Select all

| clockwork.mac
| Written by Chummer (03-16-04)
| v1.0
|
| -----------------
| Description
| -----------------
| clockwork.mac will complete all the steps necessary to make a "Jar of Clockwork Grease".
| This macro is designed to be used at any location at which the pottery wheey and kiln
| are right next to eachother.  combine.mac will automatically open and close all tradeskill
| containers as well as automatically place the final product within the first available
| bag slot so multipal iterations can occur.
|
| -----------------
| How to Begin
| -----------------
| Your inventory must have an open bag slot which must be below the bag(s) which contains
| the components to make a "Jar of Clockwork Grease".  I reccomend just having your bottom
| right inventory slot bag-free.  Your inventory must be open as well as the bag(s)
| which contain any of the components.  Make sure that no bags overlap eachother when
| they are open.  Also, the "Control-R-Click" option for tradeskill containers must be set
| to on so tradeskill containers will open with a simple right click.
|
| -----------------
| Credits
| -----------------
| The basic combining feature was basically a slightly modified version of
| Groo's combine.mac.


#turbo 10
#include advpath.inc 

#event FullInventory "There was no place to put that" 
#event CombineError "You cannot combine these items in this container type!"
#event CombineFailure "You lacked the skills to fashion the items together."
 
#chat tell

Sub Main 

/declare ContainerName global
/declare ContainerNumber global 
/declare PackCode global 
/declare Component array 
/declare i global
/declare j global
/declare Makethis global
/declare startover global
/declare keep global
/declare this global
/declare compare global


/call InitAPFVars 1 15 20 


 :Loop 
    /call AdvPathPoll
       
    :starthere
    /varset startover 0


  | Get to starting position and face the Pottery Wheel 

     /itemtarget Pottery
     /face item
     /click left item
     /delay 10
     /notify tradeskillwnd ExperimentButton leftmouse
     /varset Makethis "UnfiredSmallContainer"
     /call Combine "@Makethis"
     /call ClearCursor
     /delay 10
     /notify ContainerWindow 0 close

  | Turn arround and face the Kiln

     /itemtarget Kiln
     /face item
     /click left item
     /delay 5
     /notify tradeskillwnd ExperimentButton leftmouse
     /varset Makethis "SmallClayJar"
     /call Combine "@Makethis"
     /if @startover==1 /goto :starthere
     /call ClearCursor
     /delay 10
     /notify ContainerWindow 0 close

  | Combine Grease in Jar to make Jar of Clockwork Grease

    /varset Makethis "JarOfClockworkGrease"
    /call Combine "@Makethis"
    /call ClearCursor

    /doevents 
    /goto :Loop 
/return 

Sub WaitTilThere 
:LoopTilThere 
/if n @PathingFlag==1 { 
    /call AdvPathPoll 
    /delay 0 
    /doevents 
    /goto :LoopTilThere 
} 
/return 



|| Combine.mac by Groo Mar 8, 2004 

Sub Combine(Param0)

    /call readIni "@Param0" 
|    :Begin  
        /call ClearCursor 
        /for i 0 to 9 
            /call AddComp "@Component(@i)" @i
        /next i 
        /call DoCombine 
|        /goto :Begin 
    /return 

Sub readIni(RecipeName) 
    /echo Running @RecipeName recipe 
    
    /if "$ini("recipes.ini","@RecipeName")"=="" { 
        /echo Recipe @RecipeName not found  
        /endmacro 
    } 
    
    /varset ContainerName "$ini("recipes.ini","@RecipeName","Cont")" 
    /for i 0 to 7 
        /if "$pack(@i,name)"=="@ContainerName" /varset ContainerNumber "pack @i"
    /next i 

    /if "@ContainerName"=="Enviro" { 
        /varset PackCode "e" 
    } else { 
        /varset PackCode $right(1,"@ContainerNumber")
        /delay 10
|        /itemnotify "@ContainerNumber" rightmouseup
        /click right inv @PackCode

    } 
    
    /for i 0 to 9 
        /varset Component(@i) "$ini("recipes.ini","@RecipeName","Comp@i")"  
    /next i 
    /return 

sub ClearCursor 
    :Loop 
        /if $cursor()==NULL /return
        /varset this "$cursor(name)"
        /if "@this"=="Jar of Clockwork Grease" {
            /call FindFreeBagSlot "Jar of Clockwork Grease"
            /click left pack @i  @j
            /goto :Loop
        } else {
          /autoinv
        }  
        /delay 2 
        /doevents 
        /goto :Loop 
    /return 

sub DoCombine 
    :Loop
        /if "@ContainerName"=="Enviro" {
           /click left @ContainerName combine experiment
        } else {
           /click left pack @PackCode combine
        }   
        /delay 5 
        /doevents 
        /if $pack(@PackCode,empty)==FALSE /goto :Loop 
    /delay 5 
    /return 

sub AddComp(CompName, PackSlot) 
    /if "@CompName"=="NOTFOUND" /return 
    
    /sendkey down ctrl  

    :Loop 
        /finditem "@CompName"    
        /if $find()==FALSE { 
            /echo Could not find @CompName in inventory 
            /beep 
            /sendkey up ctrl 
            /endmacro 
        } 
        /if $cursor()==NULL /goto :Loop 
    /if "@ContainerName"=="Enviro" {
       /click left "@ContainerName" "@PackSlot" experiment
     } else {
       /click left pack "@PackCode" "@PackSlot" experiment
     } 
    /sendkey up ctrl   
    /return

Sub FindFreeBagSlot(keep)
    /varset i 0
    /varset j 0
    :findbag 
    /if @i~~8 {
      /echo No empty bag slot was found.
      /endmacro
    } else {
      /varset compare "$pack(@i,name)"
      /if "@compare"!=NULL {
        /if $pack(@i,open)==FALSE /click right inv @i
        :findslot
        /if @j~~9 {
          /varset j 0
          /varadd i 1
          /goto :findbag
        } else {
          /if $item(@i,@j,stack)!=NULL {
            /varset compare "$item(@i,@j,name)"
            /if "@compare"=="@keep" {
              /varset compare $item(@i,@j,stack)
              /if @compare<20 {
                /return
              }
            } 
            /varadd j 1
            /goto :findslot
          } else {
             /return
          }
        }
      } else {
        /varadd i 1
        /goto :findbag
      }
    }  
    /return 

Sub Event_CombineError  
    /endmacro 
    /return 

Sub Event_FullInventory 
    /endmacro 
    /return 

Sub Event_CombineFailure
    /if "@Makethis"=="SmallClayJar" {
       /varset startover 1
       /delay 10
       /notify ContainerWindow 0 close
     } else /if "@Makethis"=="UnfiredSmallContainer" { 
       /call Combine "@Makethis"
     }
    /return
Here is an example of the recipes.ini

Code: Select all

------------- Jar of Clockwork Grease ------------ 

[JarOfClockworkGrease] 
Cont=Small Clay Jar 
Comp0=Clockwork Grease 
Comp1=Clockwork Grease 

[SmallClayJar] 
Cont=Enviro
Comp0=Unfired Small Container 
Comp1=Quality Firing Sheet

[UnfiredSmallContainer] 
Cont=Enviro 
Comp0=Block of Clay 
Comp1=Small Jar Sketch
Comp2=Water Flask 
Just got done with this and havent used it enough yet to know if there are still any major bugs in it. Let me know if you find any and i will try to correct them.

Chummer

Brethin
decaying skeleton
decaying skeleton
Posts: 9
Joined: Wed Feb 18, 2004 2:48 pm

Post by Brethin » Thu Aug 26, 2004 3:50 pm

Any chance on an update on this?