automacro cm {
weight < 99%
inventory "Steel" < 669
inventory "Tsurugi [1]" > 0
priority 4
run-once 1
delay 1
call cm
}
macro cm {
$steel = @invamount (Steel)
$tsu = @eval(@invamount (Tsurugi [1]))
$steelamount = @eval(@eval(@invamount (steel)) / 10)
$i = @eval($tsu + $steelamount)
$cweight = $.weight
$mweight = @eval($.maxweight)
$avweight = @eval($mweight - $cweight)
$rmndr = @eval ($avweight % 120)
$buy = @eval(@eval (@eval (@eval($avweight - $rmndr) / 120) - 1 + $i) * 10)
if (($steel < $buy) && (@invamount (Tsurugi [1]) > 0)) goto cm
goto end
:cm
$si = 55
$upbound = @eval($si + $tsu)
log $upbound
do stand
pause 1
log upper bound is $upbound
while ($si <= $upbound) as cmloop
#log $si of $upbound
if ($si > 9) goto convertToHex
goto hex
:convertToHex
$deci = $si
$rmndr = @eval ($deci % 16)
$quo = @eval (@eval($deci - $rmndr) / 16)
if ($rmndr = 10) goto A
if ($rmndr = 11) goto B
if ($rmndr = 12) goto C
if ($rmndr = 13) goto D
if ($rmndr = 14) goto E
if ($rmndr = 15) goto F
goto hex
:A
$rmndr = A
goto hex
:B
$rmndr = B
goto hex
:C
$rmndr = C
goto hex
:D
$rmndr = D
goto hex
:E
$rmndr = E
goto hex
:F
$rmndr = F
goto hex
:hex
if ($quo > 0) goto hex1
if ($quo = 0) goto hex2
goto scm
:hex1
if (rmdnr = 0) goto norem
$hex = $quo$rmndr
goto scm
:norem
$norem = 0
$hex = $quo$norem
goto scm
:hex2
$hex = 0$rmndr
goto scm
:scm
#log $hex
if (@invamount (Tsurugi [1]) < 1) goto end
#do send 13 01 01 00 BE 09 D8 7F 50 00
do send E4 07 10 00 00 00 00 00 01 00 00 00 $hex 00 01 00
$si++
end cmloop
:end
release all
}
automacro buyT {
weight <= 87%
inventory "Tsurugi [1]" < 1
priority 1
location prt_in 168 128
run-once 1
exclusive 1
delay 3
call buy
}
macro buy {
$weight = $.weight
#lock loweight
$steel = @eval(@eval(@invamount (steel)) / 10)
$tsu = @invamount (Tsurugi [1])
$i = @eval($tsu + $steel)
$cweight = $.weight
$mweight = @eval($.maxweight * .89)
$avweight = @eval($mweight - $cweight)
$rmndr = @eval ($avweight % 120)
$buy = @eval (@eval (@eval($avweight - $rmndr) / 120) - 1 + $i)
log $i < $buy
#while ($i <= 29) as loop
do talk 0
pause 1
do store
pause 2
#pause 0.5
while ($i <= $buy) as buyloop
do buy 13
#log $i of $buy
$i++
$cweight = $.weight
end buyloop
#do north
pause 1
do charselect
if ($weight > 86%) goto buy
goto cm
:buy
release all
:cm
lock buyT
call cm
stop
#release buyT
}