Those first macros work on the deal itself. When you ask for a deal, first the macro checks if you're authorized in the overallAuth.txt file. if you are, then, it will begin a trade window and also will open a chat window asking for what you want, to make easier the deal. The macro will release the commands macro so you can use it while in the trade window.
the rest of the macros here are for accepting/ending the trade, and for locking the commands macro when you're not in a trade window.
Code: Select all
automacro dealBegin {
console /(.*) \(level (\d*)\) requests a deal/i
call {
$nick = $.lastMatch1
$auth = @eval (defined $::overallAuth{"$nick"} ? $::overallAuth{"$nick"}:"None")
if ($auth == 1) goto auth
stop
:auth
do deal
do pm $nick What do you want?
release dealCommands
}
}
automacro dealEnd {
console /(.*) finalized the Deal/i
call {
do deal
call lockAdd
}
}
automacro noDeal {
console /No deal in progress/i
call lockAdd
}
automacro dealCancel {
console /Deal Cancelled/i
call lockAdd
}
automacro startLock {
console /You are now in the game/i
call lockAdd
}
macro lockAdd {
lock dealCommands
}
Code: Select all
automacro dealCommands {
console /\(from: (.*)\) : trade (\d*|all|a|an) (.*)/i
call {
$nick = $.lastMatch1
$auth = @eval (defined $::overallAuth{"$nick"} ? $::overallAuth{"$nick"}:"None")
if ($auth == 1) goto auth
stop
:auth
$item = @Inventory ($.lastMatch3)
if ("$.lastMatch3" == "zeny") goto four
if ("$.lastMatch3" == "z") goto four
if ("$.lastMatch2" ~ "a", "an") goto one
if ($.lastMatch2 > 0) goto two
if ("$.lastMatch2" == "all") goto three
goto wrong
:one
do deal add $item 1
goto ok
:two
do deal add $item $.lastMatch2
goto ok
:three
do deal add $item
goto ok
:four
if ("$.lastMatch2" == "all") goto five
if ($.lastMatch2 > 0) goto six
goto wrong
:five
do deal add z
goto ok
:six
do deal add z $.lastMatch2
:ok
do pm $nick Okay! Anything else?
stop
:wrong
do pm $nick What did you say?
}
}
It will be locked everytime the bot logs in or it closes/cancels/finishes a trade. While it is released, you can add the following commands to make it work:
- trade [number] zeny/z --------> it will add that amount of zeny to the trade. For example, "trade 2300 z", or "trade 10 zeny"
- trade all zeny/z ----------------> it will add all it's zeny to the trade. You can type either "trade all zeny" or "trade all z"
- trade a/an [item name] ------> it will add one item of that name. For example, "trade a jellopy"
- trade [number] [item name]-> it will add that amount of that item to the trade. For example, "trade 10 garlet"
- trade all [item name] --------> it will add all items of that name. For example, "trade all red potion"
This will be finished when I manage to make another automacro (or improve the last one) to make it add all items in inventory. I guess it would use a command "i" check or something, but I dunno yet, I'll look tomorrow.
Anyways, some advice on that would be appeciated, and also some help to try this to find bugs and problems...