Trade Menu with Player

Ask for help

Moderators: Murderator+, Murderator

Post Reply
Lin(CZ)
Posts: 4
Joined: 2004-07-20 10:27:42

Trade Menu with Player

Post by Lin(CZ) »

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.
Lin(CZ)
Posts: 4
Joined: 2004-07-20 10:27:42

Post by Lin(CZ) »

there isn't anybody who knows how to make this? :-(
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

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
Lin(CZ)
Posts: 4
Joined: 2004-07-20 10:27:42

Post by Lin(CZ) »

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.
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

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

serial of container you may get by function above
Dmitrij
Posts: 14
Joined: 2004-08-13 00:00:02

Post by Dmitrij »

I dont think what is bad in this code:

(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...
Gwindor
Posts: 9
Joined: 2004-06-29 15:18:30

Post by Gwindor »

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 :oops:
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

it is much possible that bugs in trading exists cause it was not properly tested and debugged, because of freezed injection developement
Gwindor
Posts: 9
Joined: 2004-06-29 15:18:30

Post by Gwindor »

:| :( :cry: but anyway...
Thank you for everything you made until today...
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

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.
Gwindor
Posts: 9
Joined: 2004-06-29 15:18:30

Post by Gwindor »

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: 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?
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

bank box have no any relation to trade containers
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

you both use wrong syntax for trade commands. see PROPERLY what had i written above.
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

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
Gwindor
Posts: 9
Joined: 2004-06-29 15:18:30

Post by Gwindor »

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.
Gwindor
Posts: 9
Joined: 2004-06-29 15:18:30

Post by Gwindor »

Now I have found another bug :(
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.
Post Reply