Thread Tools Display Modes
10-15-05, 09:38 PM   #1
WinHack
A Deviate Faerie Dragon
Join Date: Oct 2005
Posts: 11
Automating a trade

As an L60 mage who goes on raids frequently, I am quite accustomed to being a vending machine for water and bread. I have seen mods like TellParse and Waterboy, but neither has been updated lately and neither really works the way I'd like. So without doing TOO much reverse-engineering, I'm trying to write my own simple Trade mod.

Given several complete stacks of bread or water in my inventory, I'd like to be able to type a command like /water PlayerName and have the window pop up, stack of water go into the trade window, and hit my own trade button (I know I can't hit theirs for them).

I seem to have the key components so far--I've been able to open a trade window and my trading partner sees the water in his window (though sometimes it is in trade slot 2 instead of trade slot 1), but I don't see it in mine. Yet, if I hit the trade button, off it goes and he gets it in his inventory. Clearly, I'm on the right path, but I'm missing a step or two.

Below is what I have so far. Can someone point me in the direction of an example of automated trade that already exists, or at least tell me what I've missed?

TargetByName("player_name");
InitiateTrade("target");
PickupContainerItem(bag1, slot1);
local tradeSlot = TradeFrame_GetAvailableSlot();
ClickTradeButton(tradeSlot);
TradeFrame_Update();
ClickTradeButton(1);

Not sure what else to do. Any help would be appreciated.
__________________
In theory, practice and theory are the same thing. In practice, they are not.
  Reply With Quote
10-15-05, 10:45 PM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Waterboy does that you're welcome to take parts or all of it if you want. I haven't played my mage in a long time so likely no updates for the mod soon/ever.

Basically you can't do the trade at once since server communication/potential for lag is involved so you'll need to react to events.

This is how Waterboy does it with the UI parts ignored:

Registers for TRADE_SHOW, TRADE_CLOSE, TRADE_ACCEPT_UPDATE
When you want to start a trade it sets Waterboy.TradingNow=true and then InitiateTrade("target")

events:

TRADE_SHOW when Waterboy.TradingNow==true:
for each water to trade:
PickupContainerItem(bag,slot)
DropItemOnUnit("target")

TRADE_CLOSED:
Waterboy.TradingNow = false (to prevent giving water for normal trades)

TRADE_ACCEPT_UPDATE:
if target hit accept and you didn't yet, AcceptTrade()

Lots of people stare at the trade window waiting for the mage to hit trade (and a whisper "HIT THE (&*@#(@ ACCEPT BUTTON" didn't go over well) so I added a small timer to hit Accept for them.

You may want to set a "open trade for water" mode so that anyone can open trade with you to drop water on them also. People got upset when I hit cancel to initiate the trade.

So much anger about being a mage lol. The class is a delight to play except summoning water for raids is just miserable beyond words.
  Reply With Quote
10-16-05, 10:25 AM   #3
WinHack
A Deviate Faerie Dragon
Join Date: Oct 2005
Posts: 11
You said it. I love being a mage, but I have to get to raids 30-45 minutes early just to conjure up the water and bread I know everyone's going to want...and even then I don't have all the inventory slots to support everyone's incoming requests. Which is why I decided to take the plunge into writing my own mods--to see if I could solve this problem in a specific fashion.

I am sorry you will not be updating Waterboy. I really like the different features that both WaterBoy and TellParse have. But I certainly understand player burnout.

I had a feeling that what I was attempting was a bit too simplistic to succeed by itself and that I was going to have to get into the event model. I started writing mods on Friday and by the end of my work yesterday, I was able to search inventory, move items in my inventory around, and even combine smaller stacks into larger ones. Small steps indeed, but progress is progress.

Thank you again for the pointers on Trading. I'll be trying to implement this feature today.
__________________
In theory, practice and theory are the same thing. In practice, they are not.
  Reply With Quote
10-16-05, 01:09 PM   #4
shouryuu
A Chromatic Dragonspawn
 
shouryuu's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 150
Humm have you tried using waitress?
http://www.curse-gaming.com/mod.php?addid=1304
It seems to be up to date with 1.6, I don't know about 1.7 but it's still worth a try

Yup seems to be doing everyhting you want to the TOC is at 1.6 so I'm guessing it's oout of date, but I can't say if it's not functioning with 1.7.

Last edited by shouryuu : 10-16-05 at 01:33 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Automating a trade


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off