Slave-to-Main trade macro | 95% finished D:

Moderator: Moderators

Message
Author
Darki
Been there done that!
Been there done that!
Posts: 143
Joined: 25 Oct 2008, 08:14
Noob?: No
Location: Spain, Madrid
Contact:

Slave-to-Main trade macro | 95% finished D:

#1 Post by Darki »

After doing a little dr. Frankenstein with tons of posts here and the fucking regex tutorial, I've finally come with this. The only think it needs, is another part to make it deal all items without the need of asking for them,but I guess I'll get it soon. -_-

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
}
Once you're in trade window, you can use the next automacro to ask for zeny or items:

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?
	}
}
This checks again the auth list, I made it just for security, but I guess you can just delete all from "$nick to :auth" and it will work fine.

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...
Last edited by Darki on 26 Nov 2008, 22:11, edited 1 time in total.

Darki
Been there done that!
Been there done that!
Posts: 143
Joined: 25 Oct 2008, 08:14
Noob?: No
Location: Spain, Madrid
Contact:

Re: Slave-to-Main trade macro | 95% finished D:

#2 Post by Darki »

Updated... - added the authority verification stuff.

It also has a little "bug", or I guess it's only a problem with the item game configuration... to make it add an equipement, you should write "trade all [equipement name], like "trade all knife". I guess this is because you can't add amounts of that item, so if the console does "deal add @inventory (knife) 10, or 1, it will get messed.
ImageImageImage
ImageImageImage
ImageImageImage

roxasstealth
Noob
Noob
Posts: 1
Joined: 15 Jun 2011, 03:00
Noob?: Yes

Re: Slave-to-Main trade macro | 95% finished D:

#3 Post by roxasstealth »

Hi darki!
thanks for creating this macro.

I am wondering about what kind of change that I should apply if I want to modify this macro for my need.
I have some farming bots to collect loots. Right now, i set it to autostorage and every other maintenance, I will move my Merchant around, and transfer all the things manually, which is very tiring.
So i am planning to make a macro to do trade when the weight is 50% or more, where my merchant will standby and waiting there. But the hard part is to figure out, how the trade would happen. Would it be enough to make the rogues to do deal add #number, but i also wonder what if there are leftover after the first trade is done, is there any macro commands to check if misc items still there?

Post Reply