HowTO/Snippet: Vending/Consignment System

Amadeus

The Maestro
Staff member
This is a practical use script that I wrote for myself today that will highlight the methodology that one could use to create much more complex scripts.

This script does the following:

1. Iterates through each of your vending containers
2. For each vending container, iterates through all of the items in that container.
3. For each item, searches the broker to determine the lowest price currently for sale on that item. If the price is lower than "LowestPriceWillingToSell" silver (50 silver), then remove it. Otherwise, set the item's price to match that price. If the item does not exist on the broker anywhere, it sets it to "DefaultPrice" (2 gold).
4. For each item set, it 'unlists' it, so you can list it manually with the touch of a button.

So, right now basically this script basically sets everything you you have in your vending containers to a price (and unlists it), or removes it because it's not worth anything.

To customize, you'll set the variables and you might also want to adjust the formula for the "SetPrice" line so that it sets to a certain percentage below the lowest price on the market (for example). You might also want to comment out the line that "Unlists" the items if you're so inclined and not worried if someone happens to quick buy something while you're setting up.

---

Anyway, someone could certainly take this and make a really powerful and useful script, integrating all sorts of things. Imagine it: a powerful broker script with a UI accompanying!
 

Attachments

Amadeus

The Maestro
Staff member
By the way, running this script as it is, is 100% safe. The only two things it can do is:
- Move an item back to your inventory
- Set an item's price, then unlist it

It will also echo in the console the lowest price on the market when it removes something for being 'too cheap'.

--------

Also, this requires isxeq2 version 20070628.0143 (July 7) or higher.
 

Amadeus

The Maestro
Staff member
EXAMPLE:
To have your script set your lowest price of an item to 80% of whatever the current lowest price is, change this line:
Code:
Me.Vending[${VendorCount}].Consignment[${ItemCount}]:SetPrice[${LowestPrice}]
to
Code:
LowestPrice:Set[${Math.Calc[${LowestPrice}*.80]}]
Me.Vending[${VendorCount}].Consignment[${ItemCount}]:SetPrice[${LowestPrice}]
 

Amadeus

The Maestro
Staff member
Just made a change so that the "LowestPriceWillingToSell" is the cutoff for a stack of items. If the quantity is over 50, then it sets it based upon a single stack of 50 (ie, for resources). However, if it's under 50, then it sets it for the price of that stack (ie, if you have 5 'pristine shards of conjuration')

For example, if you have 150 fulginate clusters for sale, then the "LowestPriceWillingToSell" will be based upon a stack of 50 of these. However, if you have a stack of 40 tussah roots, then the cutoff will be based upon a stack of 40.
 
Top Bottom