HOWTO: Market Interaction with ISXVG

Amadeus

The Maestro
Staff member
ISXVG now supports searching, buying, and selling on the market via the broker. While I'm not going to write entire sample scripts, I will give you a few snippets on how to do varoius things (with a few comments/ideas). I will leave it up to the major script authors to put together packaged scripts/executables that interact more fully with the broker/market system.

Please note that all of these snippets require you to be close to a broker NPC.

1. Example I: Buying an item
Code:
Pawn[Broker]:Target
Market:Begin
Market:Search[MinLevel,15,MaxLevel,30,Class,Warrior,EquipSlot,Head]
;; Choosing item #1 ...you would probably want to iterate through and pick the cheapest, etc
if ${Market.SearchItem[1].TotalCost} < 500
{
   Market.SearchItem[1]:Select    
   Market:Buy
} 
Market:End
2. Example II: Putting up an item for consignment (ie, to sell)
Code:
Pawn[Broker]:Target
Market:Begin
Me.Inventory[Improved Needle]:AddToConsignment
VGUI[_market_price_platinum]:SetText[1]
VGUI[_market_price_gold]:SetText[3]
VGUI[_market_price_silver]:SetText[50]
VGUI[_market_price_copper]:SetText[75]
Market:PlaceItem
Market:End
3. Example III: Removing an item from consignment
Code:
Pawn[Broker]:Target
Market:Begin
Market.Consignment[1]:Select
Market:CancelItemSale
Market:End
4. More Search Examples
(Note: See
http://vg.isxgames.com/wiki/index.php?title=Market.Search_Parameters
)
Code:
Market:Search[MinLevel,15,MaxLevel,30,Class,Warrior,EquipSlot,Head,Rarity,Uncommon]
Market:Search[Mask]
Market:Search[Gold Quartz Mask]
5. Other Tidbits
Code:
; after doing a search....
echo My search returned ${Market.SearchItem} items.
echo The first item was a ${Market.SearchItem[1].ToItem.Name} and has a total cost of ${Market.SearchItem[1].TotalCost} copper.
;;;
echo I have ${Market.Consignment} items up for sale right now.
echo The first item, ${Market.Consignment[1].ToItem.Name} is selling for a total price of ${Market.Consignment[1].TotalCost}

Finally, please note that you do not have to worry about having the right tab "visible" while using these members and methods. You can, for example, put items up for sale while viewing the search item list ..and vice-versa.
 

Amadeus

The Maestro
Staff member
Also, you would probably want to attach an atom to one or more of these events to verify that your methods were successful. Using these would also allow for you to know when the server is 'caught up' and it's acceptable to make another request to buy or place an item. In other words, you would probably want to have the VG_onMarketSearchComplete fire BEFORE you use the :Buy method, and you'd probably want to have the VG_onMarketPlaceItemSuccess event determine if your place item was successful and/or if it's ok to place another.

Code:
  1. VG_onMarketWindowOpen()
  2. VG_onMarketWindowClose()
  3. VG_onMarketSearchComplete()
  4. VG_onMarketPlaceItemSuccess()
  5. VG_onMarketRemoveItem()          [Note: This event fires when you either successfully buy an item, or successfully remove an item from consignment.]
 
Top Bottom