Yoko
http://forum.yoko.com.ua/

Trade Menu with Player
http://forum.yoko.com.ua/viewtopic.php?f=3&t=1035
Page 1 of 1

Author:  Lin(CZ) [ 2004-07-31 09:07:08 ]
Post subject:  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.

Author:  Lin(CZ) [ 2004-08-05 20:22:00 ]
Post subject: 

there isn't anybody who knows how to make this? :-(

Author:  Yoko [ 2004-08-06 00:20:09 ]
Post subject: 

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

Author:  Lin(CZ) [ 2004-08-06 00:50:56 ]
Post subject: 

Cool. Thxs Yoko :-)

and one more little question. If I need info about items in TradeMenu what function i must use?

example: Player John wants to sale some Hides... He put hides on me and the script detect count of hides and put some gold on my part of trade menu.

Thxs a lot.

Author:  Yoko [ 2004-08-06 13:53:11 ]
Post subject: 

the trade window you see is a 2 containers and 2 checkboxes

serial of container you may get by function above

Author:  Dmitrij [ 2004-08-19 19:21:14 ]
Post subject: 

I dont think what is bad in this code:

(transfer data from backpack ("finditem") into left trade container)

Code:
var tcl = UO.TradeContainer("left") # true
UO.MoveItem("finditem","-1",tcl) # bad


Finditem is always taken from backpack and returns into it...

Author:  Gwindor [ 2004-08-25 18:35:26 ]
Post subject: 

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:
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 :oops:

Author:  Yoko [ 2004-08-25 21:27:49 ]
Post subject: 

it is much possible that bugs in trading exists cause it was not properly tested and debugged, because of freezed injection developement

Author:  Gwindor [ 2004-08-26 19:31:30 ]
Post subject: 

:| :( :cry: but anyway...
Thank you for everything you made until today...

Author:  Yoko [ 2004-08-26 21:30:30 ]
Post subject: 

thank you. anyway if you find out bugs in injection's command use Request section to notify me. try to explain problem widely so i can repeat your doings and get same result.

Author:  Gwindor [ 2004-08-27 19:20:33 ]
Post subject: 

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?

Dmitrij wrote:
Code:
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:
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:
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?

Author:  Yoko [ 2004-08-27 20:51:55 ]
Post subject: 

bank box have no any relation to trade containers

Author:  Yoko [ 2004-08-27 21:03:42 ]
Post subject: 

you both use wrong syntax for trade commands. see PROPERLY what had i written above.

Author:  Yoko [ 2004-08-27 21:41:58 ]
Post subject: 

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

Author:  Gwindor [ 2004-08-28 20:01:02 ]
Post subject: 

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.

Author:  Gwindor [ 2004-08-28 20:03:28 ]
Post subject: 

Now I have found another bug :(
There is really no n parameter in uo.TradeContainer().
Try this:
One trade window was opened.

Code:
uo.SetReceivingContainer(uo.TradeContainer(1,"left")) #Correct serial of the left trade box was printed on the screen

Code:
uo.SetReceivingContainer(uo.TradeContainer(2,"left")) #Returns serial of the left trade box. Same result with any number as n-parameter

Code:
uo.SetReceivingContainer(uo.TradeContainer(1,"right"))#Returns serial of the LEFT!!! trade box.

Code:
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.

Page 1 of 1 All times are UTC+02:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/