Okay, starting the tests, the ARGN1 in @ItemSell isn't the 'amount of selling item'. It's the total amount of the item.
In @ItemBuy is okay.
I'm planning to check if the item have <TAG.VALUE>
If yes, open a gump for each item 'sold' and ask for confirmation of player, showing the 'tag.price' of the item and giving the correct money for the item.
Each opened dialog will be invisible while asking for confirmation.
If the player close the gump, the item appear again in the backpack.
If the player confirm the action, he get the money and the item is sent to npc vendor.
If the player disconnect, it will cancel all gumps, so don't apply the purchase.
But, I really need the ARGN1 in @ItemSell working to do it better.
Of course I can fix it using the total amount and creating buttons to choice how much amount the player want to sell.
For now is that.
Any idea is welcome.
I know its uggly and not shining... I just for tests, I hate code in notebooks... lazy too much...
This is just the base, the gump is socks but just to see how it will work.
I need know how to close the hardcoded sell gump too.
PHP Code:
ON=@ITEMSELL
SERV.B @,,1 Item Name: <ACT.NAME>
SERV.B @,,1 Amount: <ARGN1>
IF <ACT.dTAG.VALUE>
ACT.ATTR |= 090
TAG.<ACT>.ID <ACT.ID>
ACT.DIALOG D_ITEM_SELL
ACT.UPDATE
RETURN 1
ENDIF
[DIALOG D_ITEM_SELL]
200,200
RESIZEPIC 0 0 9300 200 200
TILEPIC 20 20 <ID>
DTEXT 20 40 1010 <NAME> <AMOUNT>
BUTTON 20 100 247 248 1 0 1
[DIALOG D_ITEM_SELL BUTTON]
ON=0
ATTR 0
UPDATE
SRC.TAG.<UID>
SRC.SYSMESSAGE YOU CANCELED THE SALE
RETURN 1
ON=1
SRC.GOLD += <EVAL <AMOUNT>*<dTAG.VALUE>>
REMOVE
SRC.SYSMESSAGE YOU CONFIRMED THE SALE <SRC.GOLD>
RETURN 1