Creatable amount: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>MapleMario
New page: '''int creatable_amount( item it )''' <br />Returns the amount of the item that you are capable of creating with your current inventory and skills. <p>Example: <br /><pre># end-of-ascens...
 
imported>StDoodle
(No difference)

Revision as of 22:04, 2 March 2010

int creatable_amount( item it )
Returns the amount of the item that you are capable of creating with your current inventory and skills.

Example:

# end-of-ascension scriptlet that tries to create your key lime pies
boolean create_key_lime_pies()
{

  item[int] pies;
  pies[0] = $item[boris's key lime pie];
  pies[1] = $item[jarlsberg's key lime pie];
  pies[2] = $item[sneaky pete's key lime pie];
  pies[3] = $item[digital key lime pie];
  pies[4] = $item[star key lime pie];

  boolean ret = true;

  foreach i in pies
  {

    if (item_amount(pies[i]) < 1)
    {
      
      if (creatable_amount(pies[i]) >= 1)
      {
        
        if (!create(1, pies[i])) ret = false;
        
      }
      else
      {
      
        ret = false;
      
      }
      
    }

  }

  return ret;

}