It worked fine before the recent patch, I have done a rebuild from CVS as of about 10 minutes ago, but it still did not work.[Sat Aug 09 08:55:14 2003] Ending macro: Subroutine ClearCursor wasn't found
[Sat Aug 09 08:55:14 2003] ts.mac@54 (Main): /call ClearCursor $p0
[Sat Aug 09 08:55:15 2003] Cleared the following: Timers Vars Arrays
[Sat Aug 09 08:55:15 2003] The current macro has ended.
After playing with it a few minutes I now have it working properly:
Code: Select all
| ts.mac (tradeskill.mac)
| -----------------------
| *** DESCRIPTION ***
| Syntax: /macro ts <Keep|Destroy> <CombinerName> <Component> [Component] [Component] [Component] [Component] [Component] [Component] [Component] [Component] [Component]
| Can add up to 10 components and combine them in the selected combiner. (Notice, MacroQuest NEED to be compiled to handle more than 10 paramaters, read subnote on what file to edit, and what line.)
| Can specify wether to keep or destroy the finished product, returned components WILL NOT be destroyed, only the new item(s), that isn't part of the component list.
| As a precaution, it must specifically say "destroy" (case doesn't matter, case insensitive), if it says anything else it will keep the end product.
|
| Please note that I have told the macro to use /click left done rather than /click left combine, this is due to the fact that my UI makes it click a bit off otherwise.
| There still are some minor bugs, nothing big though. Those that are bothered by them can fix them and post their changes in this thread ;)
|
| To speed up the macro I put in #turbo and /delay's after just about each mouse movement. The delay is defined the ghe global variable $dly
| Set wether to abort macro on tell or to ignore it with the global variable $abt
|
|
| *** CREDITS ***
| These are the persons I know I borrowed code from, I'm sure I forgot some..
| --
| General idea, and many of the sub routines from:
| - Gengis (http://macroquest2.com/phpBB2/viewtopic.php?p=4759#4759)
| - Pigeon (http://macroquest2.com/phpBB2/viewtopic.php?p=15523#15523)
|
| - #Wildcard sub routine idea from Serberus (http://macroquest2.com/phpBB2/viewtopic.php?p=9443#9443)
|
|
| *** TODO ***
| - Rumors say that when using "destroy", the macro is not working completely as intended. Investigating.
| - Thinking about adding some statistic Sub Routines, as in Zeuz's macro (http://macroquest2.com/phpBB2/viewtopic.php?p=16800#16800)
| - On CombineError, make the macro "/call CleanPack" 1 time, then retry combine. If CombineError 2 times in a row then "/call EndCombines".
|
|
| *** SUB NOTE ***
| Before compiling MacroQuest (note; the search strings are without the quotes):
| - OPEN "EQLib\MQ.h"
| - FIND "#define MAX_STACKVARS 10"
| - REPLACE "#define MAX_STACKVARS 30"
#turbo
#define CombStr v1
#define CombInt v2
#define TotalComp v3
#define dly v4
#define abt v5
#define cbe v6
#event FullInventory "There was no place to put that"
#event CombineError "You cannot combine these items in this container type!"
#chat tell
Sub Main
/cleanup
/varset dly 2 | SET DELAY BETWEEN MOUSE CLICKS HERE
/varset abt "FALSE" | ABORT ON RECIEVING A TELL, SET TO "TRUE" or "FALSE"
/call ClearCursor $p0
/if "$p2"=="" {
/echo Syntax: /macro ts <Keep|Destroy> <CombinerName> <Component> [Component]...
/endmacro
}
/call CombFind "$p1"
/if $CombInt<=7 /call OpenInv
/if $CombInt==8 {
/call OpenEnv
/delay $dly
}
/if $CombInt>=98 {
/if n $CombInt==99 /echo Cannot find container << $p1 >>
/if n $CombInt==98 /echo Too far away from << $p1 >>
/endmacro
}
/call HandlePacks open
/varset TotalComp 0
:CountComponents
/call ClearCursor $p0
/varset a(1,$TotalComp) "$p$int($calc($TotalComp+2))"
/varadd TotalComp 1
/if n $int($TotalComp)>10 {
/echo Syntax: /macro ts <Keep|Destroy> <CombinerName> <Component> [Component]...
/echo You can only add up to a total of 10 components.
/endmacro
}
/echo Component $int($TotalComp): $p$int($calc($TotalComp+1))
/if "$p$int($calc($TotalComp+2))"=="" {
/goto :Begin
} else {
/goto :CountComponents
}
:Begin
/for l0 0 to $int($calc($TotalComp-1))
/call AddComp "$a(1,$l0)" $l0
/next l0
:Combine
/call DoCombine
:ClearCursor
/call ClearCursor $p0
/goto :Begin
/return
Sub CleanPack
/press ctrl
/sendkey down shift
/if "$CombStr"=="enviro" {
/varset l0 10
} else {
/varcalc l0 $pack($CombInt,slots)-1
}
/for l1 0 to $l0
/click left $CombStr $l1
/delay $dly
/click left auto
/delay $dly
/next l1
/sendkey up shift
/press shift
/return
Sub HandlePacks
/varset l0 0
/if "$p0"=="open" /goto :Open
/if "$p0"=="close" /goto :Close
/if "$p0"=="" /goto :Syntax
:Open
/for l0 0 to 7
/if "$pack($int($l0))"=="TRUE" /if "$pack($int($l0),open)"=="FALSE" /click right inv $int($l0)
/delay $dly
/next l0
/goto :End
:Close
/for l0 0 to 7
/if "$pack($int($l0))"=="TRUE" /if "$pack($int($l0),open)"=="TRUE" /click right inv $int($l0)
/delay $dly
/next l0
/goto :End
:Syntax
/echo Syntax: /call HandlePacks <open|close>
/endmacro
:End
/return
Sub OpenInv
/varset CombStr "pack $CombInt"
/if "$pack($int($l0),open)"=="FALSE" /click right inv $int($l0)
/delay $dly
/if $pack($CombInt,empty)==FALSE /call CleanPack
/return
Sub ClearCursor
:Loop
/delay $dly
/if $cursor()!=NULL {
/if "$p0"=="DESTROY" {
/varset l0 0
:SubLoop
/if "$a(1,$l0)"~~"#" {
/varset l1 "$right($calc($strlen("$a(1,$l0)")-1),"$a(1,$l0)")"
/varset l2 0
} else {
/varset l1 "$a(1,$l0)"
/varset l2 1
}
/if n $l2==0 /if "$cursor(name)"~~"$l1" {
/click left auto
/delay $dly
} else /if n $l2==1 /if "$cursor(name)"=="$l1" {
/click left auto
/delay $dly
}
/if "$cursor()"!="NULL" {
/if n $l0<$TotalComp {
/varadd l0 1
/goto :SubLoop
} else {
/click left destroy
/delay $dly
}
}
} else {
/click left auto
/delay $dly
}
}
/if $cursor()!=NULL /goto :Loop
/return
Sub CombFind
/varset CombInt 99
/if "$p0"~~"#" {
/varset l1 "$right($calc($strlen("$p0")-1),"$p0")"
/varset l2 0
} else {
/varset l1 "$p0"
/varset l2 1
}
/for l3 0 to 7
/if n $l2==0 /if "$pack($l3,name)"~~"$l1" /varset CombInt $l3
/if n $l2==1 /if "$pack($l3,name)"=="$l1" /varset CombInt $l3
/next l3
/if n $CombInt==99 {
/itemtarget $p0
/if n $ground(id)==0 /varset CombInt 99
/if n $distance(item)>20 /varset CombInt 98
/if n $ground(id)>0 /if n $distance(item)<=20 /varset CombInt 8
}
/return $CombInt
Sub DoCombine
:Loop
/click left $CombStr combine | CLICK LEFT COMBINE MISSES THE COMBINE BUTTON WITH MY UI, TEMPORARY FIX BY SETTING IT TO DONE.
/doevents
/delay $dly
/if $pack($CombInt,empty)==FALSE /goto :Loop
/return
Sub AddComp
/press shift
/sendkey down ctrl
/if "$p0"~~# {
/finditem similar "$right($calc($strlen("$p0")-1),"$p0")"
} else {
/finditem "$p0"
}
/if $find()==FALSE /goto :NoComp
/delay $dly
/click left $CombStr $p1
/goto :End
:NoComp
/echo Could not find << $p0 >>
/call EndCombines
:End
/sendkey up ctrl
/press ctrl
/return
Sub EndCombines
/call CleanPack
/cleanup
/endmacro
/return
Sub Event_Chat
/if "$abt"=="TRUE" {
/echo Got a tell, stopping.
/call EndCombines
}
/return
Sub Event_CombineError
/echo You cannot combine these items in this container type!
/call EndCombines
/return
Sub Event_FullInventory
/echo Your inventory is full, ending macro.
/call EndCombines
/return
Sub OpenEnv
/varset CombInt e
/varset CombStr enviro
/face item
/delay $dly
/click left item
/delay $dly
/return



