Page 1 of 2

Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 2:25 am
by rock5
This userfunction allows you to trade items to other players.

Requirements:

To have the recipient automatically accept what you send them, use the AutoTrade addon.
http://www.curse.com/addons/rom/autotrade

Syntax:

You can use any one of a number of formats.
  • A single item. (An 'item' such as is returned from inventory:findItem.
    • tradeTo("recipient", item)
    A table of items.
    • tradeTo("recipient", {item1, item2, item3})
    A number of items by name. 'number' is optional and defaults to all.
    • tradeTo("recipient", "itemname" [,number])
    A number of items by id. 'number' is optional and defaults to all.
    • tradeTo("recipient", itemid [,number])
    A table of mixed names and ids. 'number' is optional and defaults to all.
    • tradeTo("recipient", {"itemname1", "itemname2", itemid1, itemid2}[, number])
Examples:

Send 9 Fusion Stones or Random Fusion Stones.

Code: Select all

tradeTo("recipient",{"Fusion Stone","Random Fusion Stone"}, 9)
Send all created Mana Stone Tier 7 to recipient by id

Code: Select all

tradeTo("recipient", 202846)
Send your shared stated Magicbreath Belt.

Code: Select all

local item
for slot = 61, 240 do
	item = self.BagSlot[slot]
	item:update()
	if item.Name == "Magicbreath Belt" and item.Stats > 3 then
		tradeTo("recipient", item)
		break
	end;
end;
Send all unbound stated gear.

Code: Select all

local item
local itemtable = {}
for slot = 61, 240 do
	item = self.BagSlot[slot]
	item:update()
	if item.Bound == false and item.Stats > 3 then
		table.insert(itemtable, item)
	end;
end;
tradeTo("recipient", itemtable)
Credits:

Jandrana for the initial version of the function.

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 3:55 am
by Desmond
very grateful

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 4:02 am
by Desmond
and which function is responsible for sending stones ie take Handbags stone and insert it into the cell of trade?

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 4:17 am
by rock5
I'm not sure what you mean by "handbag stone" but it sounds like you need to send by name or id.

Code: Select all

tradeTo("recipient","Handbag Stone")
or

Code: Select all

tradeTo("recipient", 123456)
Of course it would have to be the right name or id.

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 4:55 am
by Desmond
I need to write a lot of twins is how to do?

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 5:08 am
by rock5
What? Try again.

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 5:09 am
by Desmond
rock5 wrote:What? Try again.
I enter my twins 8

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 5:10 am
by Desmond
tradeTo("Islan", 202844)
I need a lot of characters Islan, Eirloa, Gopaque, Blegei, Squerst. How do I add?

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 5:40 am
by rock5
Try

Code: Select all

names={"Islan", "Eirloa", "Gopaque", "Blegei", "Squers"}
for _, name in pairs(names) do
    tradeTo(name, 202844, 1)
end
That sends 1 stone to each character on the list.

Note: I noticed when I was testing that the function stops working after sending 24 items. It seems to be a limit similar to what happens when sending too many mail. So keep that in mind.

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 5:42 am
by Desmond
thank you very much I will try

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 5:49 am
by Desmond
that does not work you can create a waypoint?

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 6:39 am
by rock5
I can't see why it wouldn't work. Remember travelTo only trades the item. It's still up to you to get everyone to the same location at the same time. Also don't forget to install the AutoTrade addon.

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 6:53 am
by Desmond
addon worth

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 6:55 am
by rock5
Desmond wrote:addon worth
What? Was that a question?

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 7:55 am
by Desmond
lol working a full bag, how to do what distributed belts all also personages?

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 8:26 am
by Desmond
Rock5, I ask please treat, does not work

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
                accountpw = {
    [5] = "do628783",
    [6] = "k80681852902",
    [7] = "Oksanya1988",
}
BuyFromItemShop(829, accountpw[getAcc()], 1)
                local ammoCount = GetInventoryItemCount("228966",1); then
                Fusion_MakeMaxManaStones(5)
		tradeTo("Islan", 202844)
                		
		
</onLoad>
</waypoints>

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 8:35 am
by rock5
please don't forget to use the code tags when posting code to this forum. Just select the code and click the "Code" button at the top of the edit box. I've done it for you this time.

It would help if you told me what it did. Did you get an error? Did it buy the items? Did it make the stones?

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 8:48 am
by Desmond
yes

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 8:50 am
by Desmond

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
                accountpw = {
    [5] = "do628783",
    [6] = "k80681852902",
    [7] = "Oksanya1988",
}
BuyFromItemShop(829, accountpw[getAcc()], 1)
                local ammoCount = GetInventoryItemCount("228966",1); then
                Fusion_MakeMaxManaStones(5)
      tradeTo("Islan", 202844)
                      
      
</onLoad>
</waypoints>

Re: Rock5's tradeTo userfunction

Posted: Wed Aug 20, 2014 9:00 am
by rock5
You have to select all the code before clicking the 'code' button. The

Code: Select all

[/b] goes before the code and [b]
[/b] goes after the code.
Desmond wrote:yes
"yes" what? Describe what happened. What didn't work?