Sell

From Kolmafia
Revision as of 09:59, 19 July 2011 by imported>Bale (r9555)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

boolean sell(coinmaster master ,int qty ,item it )

  • master is the coinmaster to purchase from
  • qty is the number to purchase
  • it is the item to purchase

Attempts to purchase qty amount of item it from master. If qty is less than 1, the function will return true without purchasing anything. Otherwise it returns true if the purchase succeeded and false if it did not.

This expands upon selling to a coinmaster to show many related functions.

boolean sell_coinmaster(int qty, item it) {
   coinmaster master = to_coinmaster(it.buyer);
   if(master == $coinmaster[none]) {
      print("You do not need a coinmaster to purchase that", "red");
      return false;
   }
   if(!is_accessible(master)) {
      print(inaccessible_reason(master), "red");
      return false;
   }
   int coins = master.available_tokens;
   int price = sell_price(master, it);
   print("Selling to "+master+" for "+price+" "+coins);
   return sell(master, qty, it);
}

CLI Equivalent

The CLI commands "buy" and "acquire" work similarly.

See Also

buy() | sell_price()