Does anyone know how to fix the TraderRequestSell().

07/13/2018 05:13 Tyranna#1
This function always returns false. I do not think that it is reading the correct
memory. Can someone verify that this function does not work, and is there someone who has the ability to fix it?
07/13/2018 15:16 mhaendler#2
Quote:
Originally Posted by Tyranna View Post
This function always returns false. I do not think that it is reading the correct
memory. Can someone verify that this function does not work, and is there someone who has the ability to fix it?
Do you stand at the Trader, when you try to sell an item?
07/13/2018 15:36 Tyranna#3
Yes, I was right next to the trader and I did not move away at any time. This function has never worked for me. Buying works, selling does not.

Should have said I am Using 3.7.11 of the GWA2.
I checked the GWA2 code and the TraderRequestSell() is expecting an ItemID which
I have successfully passed to it, verified, by outputting to the console.
07/14/2018 11:32 3vangelist#4
Quote:
Originally Posted by Tyranna View Post
Yes, I was right next to the trader and I did not move away at any time. This function has never worked for me. Buying works, selling does not.

Should have said I am Using 3.7.11 of the GWA2.
I checked the GWA2 code and the TraderRequestSell() is expecting an ItemID which
I have successfully passed to it, verified, by outputting to the console.
I use the version from [Only registered and activated users can see links. Click Here To Register...] - same version number as you, but might be worth re-downloading just to re-test.

Are you passing an Item ID, Item Struct, or Item Pointer to the function?
Is there a delay (~5 secs) between calling the function and getting the False response, or is it pretty much instant?

Also, make sure you can see that the relevent trader's window is open when you call TraderRequestSell()
07/15/2018 03:58 ayyy_lmao#5
works fine for me, post the code you are trying to use
07/15/2018 05:31 Tyranna#6
Yeah , I am using that GWA2 as well.

I am passing the item ID to the function. Looking at the code in GWA2 , that is what it wants.

The deadlock timer is functioning correctly and waiting 5 seconds before returning false.


Well, I think I found the problem. The ItemID is changing everytime you sell from the stack in your inventory requiring you to create the ItemStruct again and pull the ItemID from it again. I got a sell operation to work after this.
07/17/2018 09:22 3vangelist#7
Quote:
Originally Posted by Tyranna View Post
Yeah , I am using that GWA2 as well.

I am passing the item ID to the function. Looking at the code in GWA2 , that is what it wants.

The deadlock timer is functioning correctly and waiting 5 seconds before returning false.


Well, I think I found the problem. The ItemID is changing everytime you sell from the stack in your inventory requiring you to create the ItemStruct again and pull the ItemID from it again. I got a sell operation to work after this.
Item ID changing doesn't sound right, it should stay the same and only the quantity should change, otherwise its not a stack.

What were you selling? Were you calling TraderRequestSell then TraderSell for every item in the stack?
07/17/2018 16:24 Tyranna#8
I did not think the ItemID would change either , but , that is what I was seeing.
I output the 'ItemID' to the console on every iteration to verify it. Note: I was
selling multiple times from the same stack of Plant fibers. Yes , I was using
TraderRequestSell() followed by TraderSell().
07/17/2018 16:33 mhaendler#9
How to you get the ITEM-Id? Could you provide your code, we would be able to help you a lot quicker ;)
07/18/2018 05:50 3vangelist#10
I know you found a workaround for it but its interesting that it changes every time. The only thing I can think of is you're passing the item ID of the Merchant's sellable version of the item, not the item that is from your own inventory.
07/18/2018 10:50 LordKillfox#11
Code:
Func TraderRequestSellByCoords($TraderCoords)
  
  Local $ModelIdValue = GetItemBySlot(1,1) 
  Local $Item = GetItemBy('ModelId',$ModelIdValue)
  Local $ItemQuantity = Floor(Round(GetItemProperty($Item, 'Quantity') / 10,1))

  Local $Trader = GetNearestAgentToCoords($TraderCoords[0], $TraderCoords[1])

  GoToNPC ($Trader)

  For $i = 0 To $ItemQuantity 
    Sleep (GetPing()+100)
    TraderRequestSell($Item)
    Sleep(GetPing()+100)
    TraderSell()
  Next

EndFunc
I made this function quickly at work, so it might contain little errors.

Make sure you replace the value of $ModelIdValue with i.e. $ModelIdValue = 2903, as of now we just pass the ModelId of the first item in our Backpack.

I could not test this, but i think the problem here is that we don't need to pass the ModelId to the Trader. The TraderRequestSell() function wants us to pass the $aItem Value of the GetItemBy() function.

I hope this helped.