*Updated: Corrected one mistake on returns
DTR.mac
Code: Select all
|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Dices' Tradeskill Routines v.alpha
| by DiCeS
|
| (*) DTR.mac
|
| (*) Very early release of some routines i have been working on,
| i have added some failsafes so scripts dont stop because of lag
| will be adding more as i encounter problem stopping scripts.
| (*) Some parts where inspired with routines found in Macro Depot
| (*) Will be adding more routines as i finish them, like a recipe recorder
| using ini files, and reader, also working, on auto summoning combiners
| as needed, if there is the space to put them, and you have them in bags.
|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#event HandsDTR "Your hands must be"
#define ContainerDTR v40
|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| (*) Find Container DTR
|
| Usage: /call FindContainerDTR "Tradeskill goes here"
|
| ex. /call FindContainerDTR "Smithing"
| /call FindContainerDTR "Baking"
|
| Valid Parameters:
|
| "Brewing" "Blacksmithing" "Tailoring"
| "Baking" "Pottery" "Firing" "Jewelry Making"
| "Mixing" "Make Poison" "Fishing" "Alchemy"
| "Fletching" "Research"
|
| Returns:
|
| 9 "Cannot Find Container or not close enough to enviro
|
| 8 "Enviromental Container"
|
| 0- 7 "Inventory Slot"
|
| (*) It will set variable ContainerDTR to point to your Container
| like "pack #" or "enviro"
|
| (*) It is Best to have the container in last slot of inventory
| (*) This will check first for enviromental containers,
| then will check inventory
|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sub FindContainerDTR
/varset l1 "None"
/varset p2 8
/varset ContainerDTR "None"
/if "$p0"=="Blacksmithing" /varset l1 "Forge"
/if "$p0"=="Tailoring" /varset l1 "Loom"
/if "$p0"=="Brewing" /varset l1 "Brew Barrel"
/if "$p0"=="Baking" /varset l1 "Oven"
/if "$p0"=="Pottery" /varset l1 "Pottery Wheel"
/if "$p0"=="Firing" /varset l1 "Kiln"
|Check for Enviromental Combiner First
/if "$l1"!="None" {
/itemtarget $l1
/if n $distance(item)<=20 {
/varset ContainerDTR "enviro"
/return $p2
}
/echo "The $l1 is too far away"
/varset l1 "None"
}
|Check Inventory for Combiner
/for p2 7 downto 0
/if "$pack($p2,combine)"=="$p0" {
/varset ContainerDTR "pack $p2"
/return $p2
}
/next p2
/varset p2 9
/return $p2
|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| (*) Get And Place Component DTR
|
| Usage:
| /call GetAndPlaceComponentDTR "Component" "Container" "Position"
| ex, /call GetAndPlaceComponentDTR "Water Flask" "pack 7" "4"
| /call GetAndPlaceComponentDTR "Water Flask" "enviro" "4"
| /call GetAndPlaceComponentDTR "Water Flask" "$Container" "$Cloc"
| Returns:
| 0 Out of Components
| 1 Success
|
| (*) Is not Necesarry to keep the bags open, but is faster
| (*) Container for combines must be open
| (*) This Routine was made with lag spikes in mind, it will keep trying
| to put the components until it succeds.
|
|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sub GetAndPlaceComponentDTR
/varset p5 0
/if $cursor()==True /call ClearCursorDTR
/press shift
/sendkey down ctrl
:GetComponent
/if n $count("$p0")==0 /return $p5
/finditem "$p0"
/delay $DelayValue
:OpenPackIfNeeded
/if $pack($find(pack),open)!="True" {
/sendkey up ctrl
/press ctrl
/click right inv $find(pack)
/delay $DelayValue
/press shift
/sendkey down ctrl
}
/if $pack($find(pack),open)!="True" /goto :OpenPackIfNeeded
/doevents HandsDTR
/if $cursor()!=True /goto :GetComponent
/sendkey up ctrl
/press ctrl
:DoClick
/click left $p1 $int($p2)
/delay $DelayValue
/if "$cursor(name)"=="$p0" /goto :DoClick
/varset p5 1
/return $p5
Sub ClearCursorDTR
:AutoDrop
/click left auto
/delay $DelayValue
/if $cursor()==True /goto :AutoDrop
/return
Sub Event_HandsDTR
/call ClearCursorDTR
/return
DiCes
