automacro startup {
run-once 1
exclusive 1
log Starting up, Checking inventory...
call check_inventory
}
automacro check_shop {
run-once 1
soldout >= 1
log I'm outta something... Checking inventory...
call check_inventory
}
macro check_inventory {
## Define items and base Values. If item not in use then = Null.
## Make sure that your shop.txt file includes what you want to sell
$item1 = Red Potion
$bitem1 = 500
$item2 = Concentration Potion
$bitem2 = 20
$item3 = Orange Potion
$bitem3 = 200
log Closing Shop and Checking Inventory...
do closeshop
if ($item1 = Null) goto ierror
:citem1
$citem1 = @cartamount ($item1)
$call = 0
if ($citem1 >= $bitem1) goto noitem1
$aitem1 = @eval ($bitem1 - $citem1)
log Mmm... I need $aitem1 $item1...
$call = @eval ($call + 1)
if ($item2 = Null) goto restock
goto citem2
:noitem1
log Nope, I do not need $item1...
if ($item2 = Null) goto np
goto citem2
:citem2
$citem2 = @cartamount ($item2)
if ($citem2 >= $bitem2) goto noitem2
$aitem2 = @eval ($bitem2 - $citem2)
log Mmm... I need $aitem2 $item2...
$call = @eval ($call + 2)
if ($item3 = Null) goto restock
goto citem3
:noitem2
log Nope, I do not need $item2...
if ($item3 = Null) goto np
goto citem3
:citem3
$citem3 = @cartamount ($item3)
if ($citem3 >= $bitem3) goto noitem3
$aitem3 = @eval ($bitem3 - $citem3)
log Mmm... I need $aitem3 $item3...
$call = @eval ($call + 4)
goto restock
:noitem3
log Nope, I do not need $item3...
goto np
:restock
call restock
goto end
:np
log Inventory looks fine. Reopening Store...
do openshop
goto end
:ierror
log Item #1 can not be Null. Exiting...
goto end
:end
release check_shop
}
macro restock {
$where = $.pos
$map = $.map
if ($map = "prontera") goto prontera
if ($map = "payon") goto payon
if ($map = "prt_in") goto prontera
log HELP! I am at $map and I cant find my vendor...
goto end
:prontera
do move 129 72 prt_in
## $npc = (126 76)
do talk @npc (126 76)
call items
call return
goto end
:payon
## $npc = (159 96)
if ($where != "168 96") do move 168 96 payon
do talk @npc (159 96)
call items
call return
goto end
:end
}
macro items {
if ($call = 1) goto item1
if ($call = 2) goto item2
if ($call = 3) goto items12
if ($call = 4) goto item4
if ($call = 5) goto item23
if ($call = 6) goto item24
if ($call = 7) goto item123
if ($call >=8) goto error
goto end
:item1
do store
do buy @store ($item1) $aitem1
do cart add @inventory ($item1) $aitem1
goto end
:item2
do store
do buy @store ($item2) $aitem2
do cart add @inventory ($item2) $aitem2
goto end
:item4
do store
do buy @store ($item3) $aitem3
do cart add @inventory ($item3) $aitem3
goto end
:item12
do store
do buy @store ($item1) $aitem1
do buy @store ($item2) $aitem2
do cart add @inventory ($item1) $aitem1
do cart add @inventory ($item2) $aitem2
goto end
:item23
do store
do buy @store ($item1) $aitem1
do buy @store ($item3) $aitem3
do cart add @inventory ($item1) $aitem1
do cart add @inventory ($item3) $aitem3
goto end
:item24
do store
do buy @store ($item2) $aitem2
do buy @store ($item3) $aitem3
do cart add @inventory ($item2) $aitem2
do cart add @inventory ($item3) $aitem3
goto end
:item123
do store
do buy @store ($item1) $aitem1
do buy @store ($item2) $aitem2
do buy @store ($item3) $aitem3
do cart add @inventory ($item1) $aitem1
do cart add @inventory ($item2) $aitem2
do cart add @inventory ($item3) $aitem3
goto end
:error
log Im confused on what I need to buy. Ending...
goto end
:end
}
macro return {
log Got what I needed... Returning to $where $map
do move $where $map
do openshop
release check_shop
}
Monday, March 17, 2008
Macros Vending
Nie buat vending...
Subscribe to:
Post Comments (Atom)
1 comment:
bro.. klo cuma pingin buat macro simple, begitu vending ada yg laku (1 baris ilang/laku, bukan berkurang jumlah)
do relog aja
gmn cara ngecek vending ada yg ilang apa enga?
thx
Post a Comment