Trade Menu with Player
Moderators: Murderator+, Murderator
Trade Menu with Player
Hello, can someone tell me how to (in script :-]) :
- accept the trade with PC player
- take info about his/her offer
- put something to my offer trade menu.
thanks.
- accept the trade with PC player
- take info about his/her offer
- put something to my offer trade menu.
thanks.
yes in last published version was added Trade support. alas forum where this was declared died, and i have no time recover "Updates" topic widely.
In short, here are functions:
TradeCount - number of opened windows
TradeContainer(n,["right"]) - serial of trade box
TradeOpponent(n) - serial of trade opponent
TradeName(n) - caption of trade window
TradeCheck(n,["right"]/[newvalue]) - get/set value of trade checkbox
functions was very lightly tested by me, so experiment yourself
In short, here are functions:
TradeCount - number of opened windows
TradeContainer(n,["right"]) - serial of trade box
TradeOpponent(n) - serial of trade opponent
TradeName(n) - caption of trade window
TradeCheck(n,["right"]/[newvalue]) - get/set value of trade checkbox
functions was very lightly tested by me, so experiment yourself
I dont think what is bad in this code:
(transfer data from backpack ("finditem") into left trade container)
Finditem is always taken from backpack and returns into it...
(transfer data from backpack ("finditem") into left trade container)
Code: Select all
var tcl = UO.TradeContainer("left") # true
UO.MoveItem("finditem","-1",tcl) # bad
Finditem is always taken from backpack and returns into it...
Dmitrij wrote:Finditem is always taken from backpack and returns into it...
Yop, I have the same trouble.
I think it is a bug and right now it is impossible to move anything into the trade box.
Imho only way how to script trading with other players is to initiate every transaction from my side:
I can open trade window when I move an item directly on any character:
Code: Select all
uo.moveitem (anyitem, "-1", SerialOfAnybody)
But this is impossible if any trade window is already opened.
***
Another problem is that if any trade window is canceled the trade containers still remember all offered items. Therefor if a new trade window is opened the uo.findtype() command returns more items than the trade boxes actually contains.
But this problem is not so serious as the first one, because it may be quite fixed with using of uo.forget() command.
I know my English is horrible. I am so sorry

Well, I'll try better describe my main problem only to report you potentional bug.
I don't want to create new topic in the request section, because my post has better context here. If you want move it yourself.
As Dmitrij wrote - what is bad on this code?
I'm sure that trade window was opened (also uo.TradeCount returned 1) and I'm sure that command uo.TradeContainer() correctly returned serial of my (left side) trade box in the trade window. But "finditem" was not moved to the trade box, but to my backpack.
I also tried this...
...but with the same result. Everything ends in my backpack.
Then I tried to change the container and created this script, which grabs items to my bank box.
It works perfectly. Targeted item was moved to my bank box.
So, this is result of my experiments:
There is some problem with trade box container, which is never reachable and so I cannot move anything to it.
I use uo client v. 2.0.0b, Injection v. 0.3.30.4 alpha and I play on POL shard.
Uf, it's all I hope. Is this report you wished?
I don't want to create new topic in the request section, because my post has better context here. If you want move it yourself.
As Dmitrij wrote - what is bad on this code?
Dmitrij wrote:Code: Select all
var tcl = UO.TradeContainer("left") # true
UO.MoveItem("finditem","-1",tcl) # bad
I'm sure that trade window was opened (also uo.TradeCount returned 1) and I'm sure that command uo.TradeContainer() correctly returned serial of my (left side) trade box in the trade window. But "finditem" was not moved to the trade box, but to my backpack.
I also tried this...
Code: Select all
var cnt= uo.TradeContainer()
uo.SetReceivingContainer(cnt) # Prints serial of my trade box on the screen
uo.grab()
...but with the same result. Everything ends in my backpack.
Then I tried to change the container and created this script, which grabs items to my bank box.
Code: Select all
sub test()
var banktype ="0x0e40"
uo.serverprint("bank")
wait(1000)
uo.ignorereset()
uo.findtype (banktype, "-1", "self")
if uo.findcount() > 0 then
uo.SetReceivingContainer (uo.getserial("finditem"))
uo.print("Bank was found")
else
uo.print("Bank is too far")
end if
uo.grab()
end sub()
It works perfectly. Targeted item was moved to my bank box.
So, this is result of my experiments:
There is some problem with trade box container, which is never reachable and so I cannot move anything to it.
I use uo client v. 2.0.0b, Injection v. 0.3.30.4 alpha and I play on POL shard.
Uf, it's all I hope. Is this report you wished?
i will repeat for clearence
int uo.TradeCount() - number of opened windows
str TradeContainer(n,["right"]) - serial of trade box,by default left box of n-th opened trade window
str TradeOpponent(n) - serial of n-th trade opponent
str TradeName(n) - caption of n-th trade window
int TradeCheck(n,["right"][,newvalue]) - get/set value of trade checkbox
example: uo.tradecheck(0,"left",1)
the n experimentally may start from 1 or 0, easy to check yourself
int uo.TradeCount() - number of opened windows
str TradeContainer(n,["right"]) - serial of trade box,by default left box of n-th opened trade window
str TradeOpponent(n) - serial of n-th trade opponent
str TradeName(n) - caption of n-th trade window
int TradeCheck(n,["right"][,newvalue]) - get/set value of trade checkbox
example: uo.tradecheck(0,"left",1)
the n experimentally may start from 1 or 0, easy to check yourself
yop, my code may be was not proper, but it should work.
Only one trade box may be opened at the same time on my shard. So n-th opened trade window as default should be ok.
Also uo.tradecount() returned 1 and finally I CHECKED serial, which was returned by uo.TradeContainer(). It was the same as container of item, which I manually moved to my trade box (I used ,info command).
I used bank box only to examine if I can at all move something to any container, especially to such one, which is not bound to any physical item in the game.
Only one trade box may be opened at the same time on my shard. So n-th opened trade window as default should be ok.
Also uo.tradecount() returned 1 and finally I CHECKED serial, which was returned by uo.TradeContainer(). It was the same as container of item, which I manually moved to my trade box (I used ,info command).
I used bank box only to examine if I can at all move something to any container, especially to such one, which is not bound to any physical item in the game.
Now I have found another bug
There is really no n parameter in uo.TradeContainer().
Try this:
One trade window was opened.
I really tested it - trust me and don't be angry on me. I only notify you results of my experiments.

There is really no n parameter in uo.TradeContainer().
Try this:
One trade window was opened.
Code: Select all
uo.SetReceivingContainer(uo.TradeContainer(1,"left")) #Correct serial of the left trade box was printed on the screen
Code: Select all
uo.SetReceivingContainer(uo.TradeContainer(2,"left")) #Returns serial of the left trade box. Same result with any number as n-parameter
Code: Select all
uo.SetReceivingContainer(uo.TradeContainer(1,"right"))#Returns serial of the LEFT!!! trade box.
Code: Select all
uo.SetReceivingContainer(uo.TradeContainer("right")) #Returns serial of the RIGHT trade box.
I really tested it - trust me and don't be angry on me. I only notify you results of my experiments.