Everything in the beginning code looks good up to what I have seen posted. However, got a couple of hours of free time
(kids, wife, and cat were all sleeping

), and I made a couple more changes. Feel free to implement them.
Hopefully I didn't miss any code, lots of little changes.
Added keep or destroy to the command line, so I don't have to keep opening the macro.
Syntax will now be:
/macro ts <0-X> <CombinerName> <keep|destroy> <Component1> [Component2]..... [Component10]
Changed code so it doesn't abort if you get a tell, just pauses, if you have $abt set to true.
Moved check for combine successes, so that you don't end up with an extra combine.
Made some cosmetic changes, so you don't get echos that you shouldn't see.
Regards,
old code:
new code:
Code: Select all
#define EndOnTrivial v63
#define CombineKeep v64
old code:
new code:
old code:
new code:
Code: Select all
/varset SkillUpCounter 0
/varset CombineKeep 0
old code:
Code: Select all
/call ClearCursor $FinishedProduct
/if n $p0>0 /if n $p0<=5000 {
/echo Setting to $p0 successful attempts!
/varset DesiredSuccesses $p0
} else /if $p0==0 {
/echo Setting to unlimited attempts!
/varset DesiredSuccesses 0
} else {
/echo Invalid setting for # of attempts
/endmacro
}
/if "$p2"=="" {
/echo Syntax: /macro ts <0-X> <CombinerName> <Component> [Component]...
/endmacro
}
new code:
Code: Select all
/call ClearCursor $FinishedProduct
/if "$p2"=="destroy" {
/varset FinishedProduct "DESTROY"
/varset CombineKeep 1
} else /if "$p2"=="keep" {
/varset FinishedProduct "KEEP"
/varset CombineKeep 1
}
/if n "$CombineKeep"==0 {
/echo Syntax: /macro ts <0-X> <CombinerName> <keep|destroy> <Component> [Component]...
/endmacro
}
/if "$p3"=="" {
/echo Syntax: /macro ts <0-X> <CombinerName> <keep|destroy> <Component> [Component]...
/endmacro
}
/if n $p0>0 /if n $p0<=5000 {
/echo Setting to $p0 successful attempts!
/varset DesiredSuccesses $p0
} else /if $p0==0 {
/echo Setting to unlimited attempts!
/varset DesiredSuccesses 0
} else {
/echo Invalid setting for # of attempts
/endmacro
}
old code:
Code: Select all
:CountComponents
/varset a(1,$TotalComp) "$p$int($calc($TotalComp+2))"
/varadd TotalComp 1
/if n $int($TotalComp)>10 {
/echo Syntax: /macro ts <0-X> <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 /if "$p$int($calc($TotalComp+2))"=="" {
/goto :Begin
} else {
/goto :CountComponents
}
new code:
Code: Select all
:CountComponents
/varset a(1,$TotalComp) "$p$int($calc($TotalComp+3))"
/varadd TotalComp 1
/if n $int($TotalComp)>10 {
/echo Syntax: /macro ts <0-X> <CombinerName> <keep|destroy> <Component> [Component]...
/echo You can only add up to a total of 10 components.
/endmacro
}
/echo Component $int($TotalComp): $p$int($calc($TotalComp+2))
/if "$p$int($calc($TotalComp+3))"~~"$" {
/goto :DestroyCheck
} else /if "$p$int($calc($TotalComp+3))"=="" {
/goto :DestroyCheck
} else {
/goto :CountComponents
}
:DestroyCheck
/if $FinishedProduct=="DESTROY" {
/beep
/press F1
/echo This macro is currently set to destroy successful combines!!!!
old code:
Code: Select all
:Begin
/call ClearCursor $FinishedProduct
/doevents
/for l0 0 to $int($calc($TotalComp-1))
/call AddComp "$a(1,$l0)" $l0
/next l0
:Combine
/doevents
/call DoCombine
:ClearCursor
/doevents
/call ClearCursor $FinishedProduct
/if "$target(name,clean)"=="$char(name)" {
/echo You have targeted yourself, pausing. To resume, type /target clear or just target something else.
:HoldingPattern
/delay 2s
/if "$target(name,clean)"=="$char(name)" /goto :HoldingPattern
}
/if n $DesiredSuccesses!=0 /if n $DesiredSuccesses<=$SkillSuccessCounter {
/echo Created $int($DesiredSuccesses) items as requested!
/call EndCombines
}
/goto :Begin
new code:
Code: Select all
:Begin
/call ClearCursor $FinishedProduct
/doevents
/if "$target(name,clean)"=="$char(name)" {
/echo Pausing!! To resume, type /target clear or target something else.
:HoldingPattern
/delay 2s
/if "$target(name,clean)"=="$char(name)" /goto :HoldingPattern
}
/if n $DesiredSuccesses!=0 /if n $DesiredSuccesses<=$SkillSuccessCounter {
/echo Created $int($DesiredSuccesses) items as requested!
/call EndCombines
}
/for l0 0 to $int($calc($TotalComp-1))
/call AddComp "$a(1,$l0)" $l0
/next l0
:Combine
/doevents
/call DoCombine
:ClearCursor
/doevents
/call ClearCursor $FinishedProduct
}
/goto :Begin
old code:
Code: Select all
Sub Event_Chat
/if "$abt"=="TRUE" {
/echo Got a tell, stopping.
/call EndCombines
}
/return
new code:
Code: Select all
Sub Event_Chat
/if "$abt"=="TRUE" {
/echo Got a tell, pausing.
| /beep
/press F1
| /call EndCombines
}
/return
This change is just cosmetic, so it doesn't dump statistics, if you never made a successful combine.
old code:
Code: Select all
Sub DisplayStats
/echo Combine Statistics - Successes: $int($SkillSuccessCounter), Failures: $int($SkillFailCounter), Trivial: $int($SkillTrivialCounter)
/varcalc TotalAttempts $SkillFailCounter + $SkillSuccessCounter
/varcalc SuccessRate $SkillSuccessCounter / $TotalAttempts * 100
/varcalc SkillUpRate $SkillUpCounter / $TotalAttempts * 100
/echo Successes Rate: $int($SuccessRate) % out of $int($TotalAttempts) attempts
/if n $SkillUpCounter>0 /echo Skill Ups: $int($SkillUpCounter) , Skill Rate: $int($SkillUpRate) % out of $int($TotalAttempts) attempts
/if n $SkillTrivialCounter>0 /echo THIS ITEM IS OR HAS GONE TRIVIAL!
/return
new code:
Code: Select all
Sub DisplayStats
/echo Combine Statistics - Successes: $int($SkillSuccessCounter), Failures: $int($SkillFailCounter), Trivial: $int($SkillTrivialCounter)
/varcalc TotalAttempts $SkillFailCounter + $SkillSuccessCounter
/if $TotalAttempts>0 {
/varcalc SuccessRate $SkillSuccessCounter / $TotalAttempts * 100
/varcalc SkillUpRate $SkillUpCounter / $TotalAttempts * 100
/echo Successes Rate: $int($SuccessRate) % out of $int($TotalAttempts) attempts
} else {
/echo Unable to complete a combine. No Stats to report
}
/if n $SkillUpCounter>0 /echo Skill Ups: $int($SkillUpCounter) , Skill Rate: $int($SkillUpRate) % out of $int($TotalAttempts) attempts
/if n $SkillTrivialCounter>0 /echo THIS ITEM IS OR HAS GONE TRIVIAL!
/return